'test_value']; $mapper = new StringMapper('test_field'); $this->assertEquals('test_value', $mapper->map($result), 'String value not returned correctly'); } public function testMapSucceedsWhenFieldIsPresentAndNotString() { $result = ['a_number' => 6.7]; $mapper = new StringMapper('a_number'); $this->assertEquals('6.7', $mapper->map($result), 'Number value not returned correctly'); } public function testMapSucceedsWhenFieldIsNotPresent() { $mapper = new StringMapper('something_else'); $this->assertNull($mapper->map([]), 'Missing value not returned correctly'); } }