Ejemplo n.º 1
0
 public function testProperties()
 {
     /** test ConfigEntity */
     $this->assertNull($this->configEntity->getClassName());
     $this->assertEmpty($this->configEntity->getId());
     $this->assertNull($this->configEntity->getCreated());
     $this->configEntity->setCreated(new \DateTime('2013-01-01'));
     $this->assertEquals('2013-01-01', $this->configEntity->getCreated()->format('Y-m-d'));
     $this->assertNull($this->configEntity->getUpdated());
     $this->configEntity->setUpdated(new \DateTime('2013-01-01'));
     $this->assertEquals('2013-01-01', $this->configEntity->getUpdated()->format('Y-m-d'));
     /** test ConfigEntity prePersist */
     $this->configEntity->prePersist();
     $currentDate = new \DateTime('now', new \DateTimeZone('UTC'));
     $this->assertEquals($currentDate->format('Y-m-d'), $this->configEntity->getCreated()->format('Y-m-d'));
     /** test ConfigEntity preUpdate */
     $this->configEntity->preUpdate();
     $currentDate = new \DateTime('now', new \DateTimeZone('UTC'));
     $this->assertEquals($currentDate->format('Y-m-d'), $this->configEntity->getUpdated()->format('Y-m-d'));
     /** test ConfigField */
     $this->assertEmpty($this->configField->getId());
     $this->configField->setMode(ConfigModelManager::MODE_READONLY);
     $this->assertEquals(ConfigModelManager::MODE_READONLY, $this->configField->getMode());
     /** test ConfigValue */
     $this->assertEmpty($this->configValue->getId());
     $this->assertEmpty($this->configValue->getScope());
     $this->assertEmpty($this->configValue->getCode());
     $this->assertEmpty($this->configValue->getValue());
     $this->assertEmpty($this->configValue->getField());
     $this->assertFalse($this->configValue->getSerializable());
     $this->configValue->setSerializable(true);
     $this->assertTrue($this->configValue->getSerializable());
     $this->assertEmpty($this->configValue->getEntity());
     $this->configValue->setEntity($this->configEntity);
     $this->assertEquals($this->configEntity, $this->configValue->getEntity());
 }