Ejemplo n.º 1
0
 public function testValidation()
 {
     $integerField = Field\IntegerField::create(self::FIELDNAME);
     $this->assertTrue($integerField->validate(235));
     $this->assertFalse($integerField->validate('invalid text value.'));
     $this->assertFalse($integerField->validate(array('fnord' => 'array not acceptable')));
 }
Ejemplo n.º 2
0
 protected function __construct()
 {
     parent::__construct('Article', array(Field\TextField::create('headline'), Field\TextField::create('content'), Field\IntegerField::create('clickCount'), Field\TextField::create('author'), Field\TextField::create('email'), Field\IntegerCollectionField::create('images'), Field\TextCollectionField::create('keywords'), Field\BooleanField::create('enabled'), Field\AggregateField::create('paragraph', array('modules' => array('\\Dat0r\\Tests\\Core\\Module\\AggregateModule'))), Field\ReferenceField::create('references', array(Field\ReferenceField::OPT_REFERENCES => array(array(Field\ReferenceField::OPT_MODULE => 'Dat0r\\Tests\\Core\\Module\\RootModule', Field\ReferenceField::OPT_IDENTITY_FIELD => 'headline', Field\ReferenceField::OPT_DISPLAY_FIELD => 'headline')))), Field\KeyValueField::create('meta', array('constraints' => array('value_type' => 'dynamic')))));
 }