/** * @test */ public function whenTheOneSideIsASingletonItMayGetSeveralChildObjects() { $this->factory->defineEntity('SpaceShip'); $this->factory->defineEntity('Person', array('spaceShip' => FieldDef::reference('SpaceShip'))); $ship = $this->factory->getAsSingleton('SpaceShip'); $p1 = $this->factory->get('Person'); $p2 = $this->factory->get('Person'); $this->assertTrue($ship->getCrew()->contains($p1)); $this->assertTrue($ship->getCrew()->contains($p2)); }
/** * @test */ public function arrayElementsAreMappedToCollectionAsscociationFields() { $this->factory->defineEntity('SpaceShip'); $this->factory->defineEntity('Person', array('spaceShip' => FieldDef::reference('SpaceShip'))); $p1 = $this->factory->get('Person'); $p2 = $this->factory->get('Person'); $ship = $this->factory->get('SpaceShip', array('name' => 'Battlestar Galaxy', 'crew' => array($p1, $p2))); $this->assertTrue($ship->getCrew() instanceof ArrayCollection); $this->assertTrue($ship->getCrew()->contains($p1)); $this->assertTrue($ship->getCrew()->contains($p2)); }
private function simpleSetup() { $this->factory->defineEntity('Person', array('spaceShip' => FieldDef::reference('SpaceShip'))); $this->factory->defineEntity('Badge', array('owner' => FieldDef::reference('Person'))); $this->factory->defineEntity('SpaceShip'); }
public function setUp() { parent::setUp(); $this->factory->defineEntity('SpaceShip'); $this->factory->defineEntity('Person', array('name' => 'Eve', 'spaceShip' => FieldDef::reference('SpaceShip'))); }