StationCacheBroadCastTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Tests\Services\CacheShelfService;
  3. use App\MaterialBox;
  4. use App\Services\CacheShelfService;
  5. use App\Station;
  6. use Tests\TestCase;
  7. class StationCacheBroadCastTest extends TestCase
  8. {
  9. /** @var CacheShelfService $service */
  10. protected $service;
  11. protected $data = [];
  12. protected function setUp(): void
  13. {
  14. parent::setUp();
  15. $this->service = app(CacheShelfService::class);
  16. $this->data['parentStation'] = factory(Station::class)->create(['code'=>'testParent']);
  17. $this->data['station'] = factory(Station::class)->create(['code' => 'test','parent_id' => $this->data['parentStation']]);
  18. $this->data['materialBox'] = factory(MaterialBox::class)->create(['code'=>'testCode']);
  19. $this->service->createStationTask($this->data['station']['code'],$this->data['materialBox']);
  20. }
  21. public function test(){
  22. $this->service->_stationCacheBroadCast($this->data['station']['code'],0);
  23. }
  24. protected function tearDown(): void
  25. {
  26. Station::query()->whereIn('id',[$this->data['station']['id'],$this->data['parentStation']['0']]);
  27. parent::tearDown();
  28. }
  29. }