|
|
@@ -2,8 +2,10 @@
|
|
|
|
|
|
namespace Tests\Services\LogisticService;
|
|
|
|
|
|
+use App\Logistic;
|
|
|
use App\OracleBasCustomer;
|
|
|
use App\Services\LogisticService;
|
|
|
+use App\Services\OracleBasCustomerService;
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
@@ -19,15 +21,14 @@ class GetLogisticByCodesTest extends TestCase
|
|
|
{
|
|
|
parent::setUp(); // TODO: Change the autogenerated stub
|
|
|
$this->service = app('LogisticService');
|
|
|
- $baseCustomers = OracleBasCustomer::query()
|
|
|
- ->selectRaw('Customer_Type,CustomerID,Descr_C')
|
|
|
- ->where('Customer_Type','CA')
|
|
|
- ->get();
|
|
|
-
|
|
|
- $this->data['baseCustomers'] = $baseCustomers;
|
|
|
- $this->data['codes'] = $baseCustomers->map(function($baseCustomer){
|
|
|
- return $baseCustomer->customerid;
|
|
|
+ $logistic = factory(Logistic::class)->create();
|
|
|
+ $OracleBasCustomer = factory(OracleBasCustomer::class)->make(['customer_type' => 'CA','customerid'=>$logistic->code]);
|
|
|
+ $this->mock(OracleBasCustomerService::class,function ($mock)use($OracleBasCustomer){
|
|
|
+ $mock->shouldReceive('first')->andReturn($OracleBasCustomer);
|
|
|
});
|
|
|
+
|
|
|
+ $this->data['baseCustomers'] = $OracleBasCustomer;
|
|
|
+ $this->data['logistic'] = $logistic;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -51,7 +52,9 @@ class GetLogisticByCodesTest extends TestCase
|
|
|
|
|
|
public function tearDown(): void
|
|
|
{
|
|
|
- cache()->flush();
|
|
|
+ foreach ($this->data['baseCustomers'] as $baseCustomer) {
|
|
|
+ cache()->forget('getLogisticByCode_'.$baseCustomer['customerid']);
|
|
|
+ }
|
|
|
parent::tearDown(); // TODO: Change the autogenerated stub
|
|
|
}
|
|
|
}
|