GetGridByCodeTest.php 1019 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Tests\Services\StationCacheShelfGrid;
  3. use App\Services\StationCacheShelfGridService;
  4. use App\StationCacheShelfGrid;
  5. use Tests\TestCase;
  6. class GetGridByCodeTest extends TestCase
  7. {
  8. protected $data = [];
  9. protected function setup(): void
  10. {
  11. parent::setUp();
  12. $this->data['stationCode'] = 'station001';
  13. $this->data['grid'] = 6;
  14. $this->data['x'] = 2;
  15. $this->data['y'] = 3;
  16. $this->data['code'] = 'HAI'.$this->data['stationCode'].'-0'.$this->data['y'].'-0'.$this->data['x'];
  17. }
  18. function testGetGridByCodeTest()
  19. {
  20. list($stationCode, $gridId, $x, $y) = StationCacheShelfGrid::getGridByCode($this->data['code']);
  21. $this->assertEquals($stationCode,$this->data['stationCode']);
  22. $this->assertEquals($gridId,$this->data['grid']);
  23. $this->assertEquals($x,$this->data['x']);
  24. $this->assertEquals($y,$this->data['y']);
  25. }
  26. protected function tearDown(): void
  27. {
  28. parent::tearDown();
  29. }
  30. }