public function testJSON() { $attribute = DataMapper\Types::normalizeAttribute(array('type' => 'json')); $this->assertTrue($attribute['strict']); $type = $this->getType('json'); $this->assertInstanceOf('\\Lysine\\DataMapper\\Types\\JSON', $type); $this->assertInstanceOf('\\Lysine\\DataMapper\\Types\\Mixed', $type); $json = array('foo' => 'bar'); $this->assertEquals($json, $type->normalize($json, array())); $this->assertEquals($json, $type->normalize(json_encode($json), array())); $this->assertNull($type->store(array(), array())); $this->assertEquals(json_encode($json), $type->store($json, array())); $this->setExpectedException('\\UnexpectedValueException'); $type->restore('{"a"', array()); $this->assertSame(array(), $type->getDefaultValue(array())); $this->assertSame(array(), $type->getDefaultValue(array('allow_null' => true))); }