public function testGetByEmptyId()
 {
     foreach (DBTestPool::me()->getPool() as $db) {
         DBPool::me()->setDefault($db);
         $this->getByEmptyIdTest(0);
         $this->getByEmptyIdTest(null);
         $this->getByEmptyIdTest('');
         $this->getByEmptyIdTest('0');
         $this->getByEmptyIdTest(false);
         $empty = TestLazy::create();
         $this->assertNull($empty->getCity());
         $this->assertNull($empty->getCityOptional());
         $this->assertNull($empty->getEnum());
         $this->assertNull($empty->getStaticEnum());
     }
 }
Ejemplo n.º 2
0
 private function lazyTest()
 {
     $city = TestCity::dao()->getById(1);
     $object = TestLazy::dao()->add(TestLazy::create()->setCity($city)->setCityOptional($city)->setEnum(new ImageType(ImageType::getAnyId())));
     Cache::me()->clean();
     $form = TestLazy::proto()->makeForm();
     $form->import(array('id' => $object->getId()));
     $this->assertNotNull($form->getValue('id'));
     FormUtils::object2form($object, $form);
     foreach ($object->proto()->getPropertyList() as $name => $property) {
         if ($property->getRelationId() == MetaRelation::ONE_TO_ONE && $property->getFetchStrategyId() == FetchStrategy::LAZY) {
             $this->assertEquals($object->{$property->getGetter()}(), $form->getValue($name));
         }
     }
 }