ArrayTest::testMapTypedSimpleArray PHP Method

testMapTypedSimpleArray() public method

Test for an array of classes "@var ClassName[]" with flat/simple json values (string)
    public function testMapTypedSimpleArray()
    {
        $jm = new JsonMapper();
        $sn = $jm->map(json_decode('{"typedSimpleArray":["2014-01-02",null,"2014-05-07"]}'), new JsonMapperTest_Array());
        $this->assertInternalType('array', $sn->typedSimpleArray);
        $this->assertEquals(3, count($sn->typedSimpleArray));
        $this->assertInstanceOf('DateTime', $sn->typedSimpleArray[0]);
        $this->assertNull($sn->typedSimpleArray[1]);
        $this->assertInstanceOf('DateTime', $sn->typedSimpleArray[2]);
        $this->assertEquals('2014-01-02', $sn->typedSimpleArray[0]->format('Y-m-d'));
        $this->assertEquals('2014-05-07', $sn->typedSimpleArray[2]->format('Y-m-d'));
    }