| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace Tests\Services\StoreService;
- use App\Services\StoreService;
- use Illuminate\Support\Facades\DB;
- use Tests\TestCase;
- class InsertStoreTest extends TestCase
- {
- /** @var StoreService $service */
- public $service;
- public $params=[];
- public function setUp(): void
- {
- parent::setUp(); // TODO: Change the autogenerated stub
- $this->service=app(StoreService::class);
- $data1=[
- 'asn_code' => 'ASN2010210111',
- 'warehouse_id' =>2,
- 'owner_id' => 2,
- 'stored_method' =>'退货入库',
- 'status' =>'完全收货',
- 'remark' => 'test',
- 'created_at'=>'2020-11-06 14:32:00',
- 'updated_at'=>'2020-11-06 14:32:00',
- ];
- array_push($this->params,$data1);
- $data2=[
- 'asn_code' => 'ASN2010210222',
- 'warehouse_id' =>2,
- 'owner_id' => 2,
- 'stored_method' =>'退货入库',
- 'status' =>'完全收货',
- 'remark' => 'test',
- 'created_at'=>'2020-11-06 14:32:00',
- 'updated_at'=>'2020-11-06 14:32:00',
- ];
- array_push($this->params,$data2);
- }
- public function testInsertStore(){
- $stores=$this->service->insertStore($this->params);
- $this->assertNotEmpty($stores);
- $this->assertDatabaseHas('stores',$this->params[0]);
- }
- public function tearDown(): void
- {
- DB::table('stores')->whereIn('asn_code',data_get($this->params,'*.asn_code'))->delete();
- parent::tearDown(); // TODO: Change the autogenerated stub
- }
- }
|