|
|
@@ -0,0 +1,51 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace Tests\Unit\StationRuleBatchService;
|
|
|
+
|
|
|
+use App\Batch;
|
|
|
+use App\Owner;
|
|
|
+use App\Services\BatchService;
|
|
|
+use App\Services\OwnerService;
|
|
|
+use App\Services\StationRuleBatchService;
|
|
|
+use App\StationRuleBatch;
|
|
|
+use Tests\TestCase;
|
|
|
+
|
|
|
+class GetBatches_shouldProcessTest extends TestCase
|
|
|
+{
|
|
|
+ /** @var StationRuleBatchService $service */
|
|
|
+ private $service;
|
|
|
+ /** @var BatchService $batchService */
|
|
|
+ private $batchService;
|
|
|
+ private $data = [];
|
|
|
+
|
|
|
+ public function setUp(): void
|
|
|
+ {
|
|
|
+ parent::setUp();
|
|
|
+ $this->service = app('StationRuleBatchService');
|
|
|
+ $this->batchService = app('BatchService');
|
|
|
+ $this->data['stationRuleBatches'] = factory(StationRuleBatch::class)
|
|
|
+ ->create([]);
|
|
|
+ $this->data['batches'] = factory(Batch::class,3)->create([
|
|
|
+
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @test
|
|
|
+ */
|
|
|
+ public function getShopByCodeMap()
|
|
|
+ {
|
|
|
+ $shop = $this->service->getShopByCodeMap($this->data['map']);
|
|
|
+ $this->assertNotNull($shop);
|
|
|
+ $orderHeader = $this->data['orderHeader'];
|
|
|
+ $owner = Owner::find($shop->first()->owner_id);
|
|
|
+ $this->assertEquals($owner->code,$orderHeader['customerid']);
|
|
|
+ $this->assertEquals($shop->first()->name,$orderHeader['issuepartyname']);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function tearDown(): void
|
|
|
+ {
|
|
|
+ cache()->flush();
|
|
|
+ parent::tearDown(); // TODO: Change the autogenerated stub
|
|
|
+ }
|
|
|
+}
|