/** * Tests `::toArray()` method. */ public function testToArray() { $dataMapper = new ArraySerializer(); $hobbit = new Fixtures\Hobbit(); $hobbit->setId(1); $hobbit->setName('Frodo'); $hobbit->setHeight(140); $hobbit->setSurname('Baggins'); $this->assertEquals(['id' => 1, 'name' => 'Frodo', 'height' => 140, 'surname' => 'Baggins'], $dataMapper->toArray($hobbit)); }
/** * Builds a fixture object instance from data. * * @param array $data Data. * * @return Fixtures\Hobbit */ protected function provideHobbit(array $data) { $hobbit = new Fixtures\Hobbit(); $hobbit->fromArray($data); return $hobbit; }