public function testGetValue() { $reader = new AccessorReader(); $team = new Team(); $team->setName('New Name'); static::assertEquals('New Name', $reader->getValue($team, 'name')); }
public function testSerializeJson() { $team = new Team('Dream Team'); $team->setPlayers([new Player('Player 1', 1)]); $array = Object2ArrayBuilder::create()->build()->createArray($team); static::assertEquals('{"name":"Dream Team","manager":[],"players":[{"name":"Player 1","number":1}]}', json_encode($array)); }
public function testGetValue() { $reader = new ReflectionReader(); $team = new Team(); $team->setName('New Name'); static::assertEquals('New Name', $reader->getValue($team, 'name')); $reader = new ReflectionReader(true); static::assertNull($reader->getValue($team, 'name')); }