/** * @test */ public function clonedModelHas1toNRelationWithCloneAsParentModel() { $childRecord = new Tx_Oelib_Tests_Unit_Fixtures_TestingChildModel(); $childRecord->setData(array()); $this->subject->addCompositionRecord($childRecord); $this->dataMapper->save($this->subject); self::assertSame($this->subject, $this->subject->getRelatedRecords()->getParentModel()); $clone = clone $this->subject; self::assertSame($clone, $clone->getComposition()->getParentModel()); }
/** * @test */ public function oneToManyRelationsWithOneRelatedModelReturnsListWithRelatedModelWithData() { $relatedTitle = 'Triss Merrigold'; $uid = $this->testingFramework->createRecord('tx_oelib_test', array('composition' => 1)); $this->testingFramework->createRecord('tx_oelib_testchild', array('parent' => $uid, 'title' => $relatedTitle)); /** @var Tx_Oelib_Tests_Unit_Fixtures_TestingModel $model */ $model = $this->subject->find($uid); /** @var Tx_Oelib_Tests_Unit_Fixtures_TestingModel $firstChildModel */ $firstChildModel = $model->getComposition()->first(); self::assertSame($relatedTitle, $firstChildModel->getTitle()); }
/** * @test */ public function getTableNameReturnsTableName() { self::assertSame('tx_oelib_test', $this->subject->getTableName()); }