| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace Tests\Services\ShopService;
- use App\OracleDOCOrderHeader;
- use App\Owner;
- use App\Services\OwnerService;
- use App\Services\ShopService;
- use Carbon\Carbon;
- use Illuminate\Foundation\Testing\RefreshDatabase;
- use Illuminate\Foundation\Testing\WithFaker;
- use Tests\TestCase;
- class GetShopByCodeMapTest extends TestCase
- {
- /** @var OwnerService $service */
- private $service;
- private $data;
- public function setUp(): void
- {
- parent::setUp(); // TODO: Change the autogenerated stub
- $this->service = app('ShopService');
- $this->data = [];
- $orderHeader = OracleDOCOrderHeader::query()
- ->whereNotNull('issuepartyname')
- ->where('sostatus','99')
- ->orderByDesc('AddTime')
- ->first();
- $this->data['orderHeader'] = $orderHeader;
- $this->data['map'][] = [
- 'owner_code' => $orderHeader['customerid'],
- 'issuepartyname' => $orderHeader['issuepartyname']
- ];
- }
- /**
- * @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
- {
- parent::tearDown(); // TODO: Change the autogenerated stub
- }
- }
|