コード例 #1
0
 public function testGetList()
 {
     $primitive = Primitive::enum('enum')->of('MimeType');
     $enum = MimeType::wrap(1);
     $this->assertEquals($primitive->getList(), MimeType::getObjectList());
     $primitive->setDefault($enum);
     $this->assertEquals($primitive->getList(), MimeType::getObjectList());
     $primitive->import(array('enum' => MimeType::getAnyId()));
     $this->assertEquals($primitive->getList(), MimeType::getObjectList());
 }
コード例 #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()))->setStaticEnum(new MimeType(MimeType::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));
         }
     }
 }