StationCacheBroadCastTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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();
  17. $this->data['station'] = factory(Station::class)->create(['parent_id' => $this->data['parentStation']]);
  18. $this->data['materialBox'] = factory(MaterialBox::class)->create();
  19. $this->service->createStationTask($this->data['station']['code'],$this->data['materialBox']);
  20. }
  21. public function test(){
  22. // 广播测试
  23. $this->assertTrue(true);
  24. // $this->service->_stationCacheBroadCast($this->data['station']['code'],0);
  25. }
  26. protected function tearDown(): void
  27. {
  28. if($this->data['parentStation'])Station::query()->where('id',$this->data['station']['id'])->delete();
  29. if($this->data['station'])Station::query()->where('id',$this->data['station']['id'])->delete();
  30. if($this->data['materialBox'])MaterialBox::query()->where('id',$this->data['materialBox']['id'])->delete();
  31. parent::tearDown();
  32. }
  33. }