public function testBuildMetaSetter() { $builder = new EntityBuilder('Person', $this->module); $builder->createDefaultId(); $builder->createProperty('email', $this->createType('Email')); $builder->createProperty('name', $this->createType('String')); $builder->createProperty('firstName', $this->createType('String')); $builder->createProperty('birthday', $this->createType('DateTime')); $builder->buildSetMetaGetter(); $class = $builder->getGClass(); $this->assertTrue($class->hasMethod('getSetMeta')); $metaGet = $class->getMethod('getSetMeta'); //attention: fragile test here $metaGetPHP = <<<'PHP' public static function getSetMeta() { return new \Psc\Data\SetMeta(array( 'id' => new \Webforge\Types\IdType(), 'email' => new \Webforge\Types\EmailType(), 'name' => new \Webforge\Types\StringType(), 'firstName' => new \Webforge\Types\StringType(), 'birthday' => new \Webforge\Types\DateTimeType(), )); } PHP; $this->assertEquals($metaGetPHP, $metaGet->php()); }
public function testManyToOne_Unidirectional() { $this->game2sound = new EntityRelation($this->game, $this->sound, EntityRelation::MANY_TO_ONE, EntityRelation::UNIDIRECTIONAL); $this->game2sound->setNullable(TRUE); $builder = new EntityBuilder('Game', $this->module); $builder->createDefaultId(); $builder->buildRelation($this->game2sound); $m2o = $this->assertCommonRelation($builder, 'sound', 'ManyToOne', 'Psc\\Entities\\Sound'); $this->assertNull($m2o->inversedBy); }