コード例 #1
0
 /**
  *
  */
 public function test_it_deserializes_stdClass()
 {
     $json = '{"name":"mock_contestant","score":100,"key":"h"}';
     $factory = new ContestantFactory();
     $contestant = $factory->createFromObject(json_decode($json));
     $this->assertSame('mock_contestant', $contestant->getName());
     $this->assertEquals(100, $contestant->getScore());
     $this->assertEquals('H', $contestant->getKey());
 }
コード例 #2
0
 public function test_it_deserializes_stdClass()
 {
     $json = '{"name":"mock_contestant","score":100}';
     $factory = new ContestantFactory();
     $contestant = $factory->createFromObject(json_decode($json));
     // The contestant should have an uppercase first letter.
     $this->assertEquals("Mock_contestant", $contestant->getName());
     $this->assertEquals(100, $contestant->getScore());
 }