/** * */ 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()); }
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()); }