コード例 #1
0
 public function testGetValue()
 {
     $reader = new AccessorReader();
     $team = new Team();
     $team->setName('New Name');
     static::assertEquals('New Name', $reader->getValue($team, 'name'));
 }
コード例 #2
0
 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));
 }
コード例 #3
0
 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'));
 }