public function testSetClientValueAndGetClientValue() { $em = self::$em; $intEntry = new CE('entry1'); $this->assertEquals('entry1', $intEntry->getName()); $this->assertEquals(CE::TYPE_INT, $intEntry->setDenormalizedValue(123)); $this->assertEquals(123, $intEntry->getDenormalizedValue()); $stringValue = new CE('entry2'); $this->assertEquals(CE::TYPE_STRING, $stringValue->setDenormalizedValue('blahblah')); $this->assertEquals('blahblah', $stringValue->getDenormalizedValue()); $textValue = new CE('entry3'); $this->assertEquals(CE::TYPE_TEXT, $textValue->setDenormalizedValue(str_repeat('foo', 100))); $this->assertEquals(str_repeat('foo', 100), $textValue->getDenormalizedValue()); $arrayValue = new CE('entry4'); $this->assertEquals(CE::TYPE_ARRAY, $arrayValue->setDenormalizedValue(array('foo'))); $this->assertSame(array('foo'), $arrayValue->getDenormalizedValue()); $floatValue = new CE('entry5'); $this->assertEquals(CE::TYPE_FLOAT, $floatValue->setDenormalizedValue(1.2345)); $this->assertEquals(1.2345, $floatValue->getDenormalizedValue()); $floatValue2 = new CE('entry6'); $this->assertEquals(CE::TYPE_FLOAT, $floatValue2->setDenormalizedValue(0.008999999999999999)); $this->assertEquals(0.008999999999999999, $floatValue2->getDenormalizedValue()); $boolValue = new CE('entry7'); $this->assertEquals(CE::TYPE_BOOL, $boolValue->setDenormalizedValue(true)); $this->assertTrue(true === $boolValue->getDenormalizedValue()); foreach (array($intEntry, $stringValue, $textValue, $arrayValue, $floatValue, $floatValue2, $boolValue) as $ce) { $em->persist($ce); $em->flush(); $this->assertNotNull($intEntry->getId()); } $em->clear(); /* @var CE $floatValue2 */ $floatValue2 = self::$em->find(CE::clazz(), $floatValue2->getId()); $this->assertEquals(CE::TYPE_FLOAT, $floatValue2->getSavedAs()); $this->assertTrue(is_float($floatValue2->getValue())); $this->assertEquals(0.008999999999999999, $floatValue2->getValue()); }