<?php


namespace Tests\Services\StationCacheShelfGrid;

use App\Services\StationCacheShelfGridService;
use App\StationCacheShelfGrid;
use Tests\TestCase;

class GetGridByCodeTest extends TestCase
{
    protected $data = [];

    protected function setup(): void
    {
        parent::setUp();
        $this->data['stationCode'] = 'station001';
        $this->data['grid'] = 6;
        $this->data['x'] = 2;
        $this->data['y'] = 3;
        $this->data['code'] = 'HAI'.$this->data['stationCode'].'-0'.$this->data['y'].'-0'.$this->data['x'];

    }

    function testGetGridByCodeTest()
    {
        list($stationCode, $gridId, $x, $y) = StationCacheShelfGrid::getGridByCode($this->data['code']);
        $this->assertEquals($stationCode,$this->data['stationCode']);
        $this->assertEquals($gridId,$this->data['grid']);
        $this->assertEquals($x,$this->data['x']);
        $this->assertEquals($y,$this->data['y']);
    }

    protected function tearDown(): void
    {
        parent::tearDown();
    }
}
