| Total Complexity | 5 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class MapColumnTest extends CommonTestClass |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @throws ConnectException |
||
| 16 | */ |
||
| 17 | public function testMapTrans(): void |
||
| 18 | { |
||
| 19 | $lib = new Columns\Map('here', $this->mapTrans(), 'not here'); |
||
| 20 | $this->assertEquals('pasive', $lib->getValue($this->getRow())); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @throws ConnectException |
||
| 25 | */ |
||
| 26 | public function testMapNot(): void |
||
| 27 | { |
||
| 28 | $lib = new Columns\Map('far', $this->mapTrans(), 'not here'); |
||
| 29 | $this->assertEquals('not here', $lib->getValue($this->getRow())); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @throws ConnectException |
||
| 34 | */ |
||
| 35 | public function testMapWtf(): void |
||
| 36 | { |
||
| 37 | $lib = new Columns\Map('out', $this->mapTrans(), 'not here'); |
||
| 38 | $this->assertEquals('456', $lib->getValue($this->getRow())); |
||
| 39 | } |
||
| 40 | |||
| 41 | protected function getRow(): Row |
||
| 42 | { |
||
| 43 | return new Row(['id' => 2, 'here' => 1, 'far' => 0, 'out' => 456]); |
||
| 44 | } |
||
| 45 | |||
| 46 | protected function mapTrans(): array |
||
| 47 | { |
||
| 48 | return [ |
||
| 49 | 1 => 'pasive', |
||
| 50 | 2 => 'active', |
||
| 51 | 3 => 'roar', |
||
| 52 | ]; |
||
| 55 |