diff --git a/tests/Doctrine/Tests/Models/CompositeKeyInheritance/SingleChildClass.php b/tests/Doctrine/Tests/Models/CompositeKeyInheritance/SingleChildClass.php new file mode 100644 index 000000000..05579bce4 --- /dev/null +++ b/tests/Doctrine/Tests/Models/CompositeKeyInheritance/SingleChildClass.php @@ -0,0 +1,21 @@ +useModelSet('compositekeyinheritance'); + parent::setUp(); + + } + + /** + * + */ + public function testInsertWithCompositeKey() + { + $childEntity = new SingleChildClass(); + $this->_em->persist($childEntity); + $this->_em->flush(); + + $this->_em->clear(); + + $entity = $this->findEntity(); + $this->assertEquals($childEntity, $entity); + } + + /** + * + */ + public function testUpdateWithCompositeKey() + { + $childEntity = new SingleChildClass(); + $this->_em->persist($childEntity); + $this->_em->flush(); + + $this->_em->clear(); + + $entity = $this->findEntity(); + $entity->extension = 'ext-new'; + $this->_em->persist($entity); + $this->_em->flush(); + + $this->_em->clear(); + + $persistedEntity = $this->findEntity(); + $this->assertEquals($entity, $persistedEntity); + } + + /** + * @return \Doctrine\Tests\Models\CompositeKeyInheritance\JoinedChildClass + */ + private function findEntity() + { + return $this->_em->find( + 'Doctrine\Tests\Models\CompositeKeyInheritance\SingleRootClass', + array('keyPart1' => 'part-1', 'keyPart2' => 'part-2') + ); + } +} diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index 872f86c81..18fd19297 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -127,6 +127,8 @@ abstract class OrmFunctionalTestCase extends OrmTestCase 'compositekeyinheritance' => array( 'Doctrine\Tests\Models\CompositeKeyInheritance\JoinedRootClass', 'Doctrine\Tests\Models\CompositeKeyInheritance\JoinedChildClass', + 'Doctrine\Tests\Models\CompositeKeyInheritance\SingleRootClass', + 'Doctrine\Tests\Models\CompositeKeyInheritance\SingleChildClass', ) ); @@ -246,6 +248,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase if (isset($this->_usedModelSets['compositekeyinheritance'])) { $conn->executeUpdate('DELETE FROM JoinedChildClass'); $conn->executeUpdate('DELETE FROM JoinedRootClass'); + $conn->executeUpdate('DELETE FROM SingleRootClass'); }