From 6a89de51e547117dfa03740c51e37235395e8ad5 Mon Sep 17 00:00:00 2001 From: "Fabio B. Silva" Date: Thu, 8 Sep 2011 12:55:55 -0300 Subject: [PATCH] change tests --- .../Tests/Models/DDC869/DDC869Payment.php | 2 +- .../ORM/Mapping/AbstractMappingDriverTest.php | 2 +- .../Mapping/BasicInheritanceMappingTest.php | 47 +++++-------------- 3 files changed, 15 insertions(+), 36 deletions(-) diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php index e64215ad3..7c4cfc975 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php @@ -31,7 +31,7 @@ class DDC869Payment * @Column(type="integer") * @GeneratedValue */ - private $id; + protected $id; /** @column(type="float") */ protected $value; diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index 779713a51..0094c1b79 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -295,7 +295,7 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase /** * @group DDC-869 */ - public function testSuperclassWithRepository() + public function testMappedSuperclassWithRepository() { if (strpos(get_class($this), 'PHPMappingDriver') !== false) { $this->markTestSkipped('PHP Mapping Drivers have no defaults.'); diff --git a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php index c7330283e..7d31b8586 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php @@ -53,22 +53,11 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase $this->assertTrue(isset($class->associationMappings['mappedRelated1'])); } + /** + * @group DDC-869 + */ public function testGetMetadataForSubclassWithMappedSuperclassWhithRepository() { - $class = $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\SubclassWithoutRepository'); - - $this->assertTrue(empty($class->subClasses)); - $this->assertTrue(empty($class->parentClasses)); - $this->assertEquals($class->customRepositoryClassName, "App\Reposotories\SuperRepository"); - - - $class = $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\SubclassWithRepository'); - - $this->assertTrue(empty($class->subClasses)); - $this->assertTrue(isset($class->fieldMappings['name'])); - $this->assertEquals($class->customRepositoryClassName, "App\Reposotories\SubRepository"); - - $class = $this->_factory->getMetadataFor('Doctrine\Tests\Models\DDC869\DDC869CreditCardPayment'); $this->assertTrue(isset($class->fieldMappings['id'])); @@ -83,6 +72,14 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase $this->assertTrue(isset($class->fieldMappings['value'])); $this->assertTrue(isset($class->fieldMappings['serialNumber'])); $this->assertEquals($class->customRepositoryClassName, "Doctrine\Tests\Models\DDC869\DDC869PaymentRepository"); + + + // override repositoryClass + $class = $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\SubclassWithRepository'); + + $this->assertTrue(isset($class->fieldMappings['id'])); + $this->assertTrue(isset($class->fieldMappings['value'])); + $this->assertEquals($class->customRepositoryClassName, "Doctrine\ORM\EntityRepository"); } /** @@ -312,27 +309,9 @@ class MediumSuperclassEntity extends MediumSuperclassBase } /** - * @MappedSuperclass(repositoryClass = "App\Reposotories\SuperRepository") + * @Entity(repositoryClass = "Doctrine\ORM\EntityRepository") */ -abstract class SuperclassBaseWithRepository -{ - /** @Id @Column(type="integer") */ - public $id; - /** @Column(type="string") */ - public $name; -} - -/** - * @Entity - */ -class SubclassWithoutRepository extends SuperclassBaseWithRepository -{ - -} -/** - * @Entity(repositoryClass = "App\Reposotories\SubRepository") - */ -class SubclassWithRepository extends SuperclassBaseWithRepository +class SubclassWithRepository extends \Doctrine\Tests\Models\DDC869\DDC869Payment { } \ No newline at end of file