| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace Tests\Services\ForeignHaiRoboticsService;
- use App\MaterialBox;
- use App\Services\ForeignHaiRoboticsService;
- use App\Station;
- use App\StationTaskMaterialBox;
- use Tests\TestCase;
- use App\Traits\TestMockSubServices;
- class TaskUpdateTest extends TestCase
- {
- use TestMockSubServices;
- /** @var ForeignHaiRoboticsService $service */
- public $service;
- private $data;
- private $amount=2;
- function setUp(): void
- {
- parent::setUp();
- $this->service = app('ForeignHaiRoboticsService');
- $this->data['station'] = factory(Station::class)->create();
- $this->data['materialBox'] = factory(MaterialBox::class)->create();
- $this->data['stationTaskMaterialBox'] = factory(StationTaskMaterialBox::class)->create([
- 'station_id' => 1,
- 'material_box_id' => $this->data['materialBox']['id'],
- ]);
- $this->data['task']=[
- 'taskCode'=>md5(microtime(true)),
- 'updateEventType' => 0,
- 'status'=>0,
- 'binCode'=>factory(MaterialBox::class)->create()
- ];
- }
- public function testReturned()
- {
- $this->assertTrue(true);
- }
- public function testMissionFailed()
- {
- $this->data['task']['status']=1;
- $this->assertFalse($this->service->taskUpdate(
- $this->data['task']['taskCode'],
- $this->data['task']['updateEventType'],
- $this->data['task']['status'],
- $this->data['task']['binCode']
- ));
- }
- public function testMissionFailed()
- {
- $this->data['task']['status']=1;
- $this->assertFalse($this->service->taskUpdate(
- $this->data['task']['taskCode'],
- $this->data['task']['updateEventType'],
- $this->data['task']['status'],
- $this->data['task']['binCode']
- ));
- }
- function tearDown(): void
- {
- MaterialBox::query()
- ->whereIn('id',[$this->data['task']['binCode']['id']??''])
- ->delete();
- parent::tearDown();
- }
- }
|