/** * Test a setter method with a namespaced type hint that * is within another namespace than the object itself. */ public function testSetterNamespacedTypeHint() { $mapper = new JsonMapper(); $json = '{"namespacedTypeHint":"Foo"}'; $res = $mapper->map(json_decode($json), new UnitData()); $this->assertInstanceOf('\\namespacetest\\UnitData', $res); $this->assertInstanceOf('\\othernamespace\\Foo', $res->internalData['namespacedTypeHint']); $this->assertEquals('Foo', $res->internalData['namespacedTypeHint']->name); }
public function testCaseInsensitivePropertyMatching() { $jm = new JsonMapper(); $sn = $jm->map((object) array('PINT' => 2), new JsonMapperTest_Simple()); $this->assertSame(2, $sn->pint); }