Skip to content

Commit

Permalink
#1196 DDC-3418 DDC-3419 - Renamed _factory to cmf
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Nov 27, 2014
1 parent 291b686 commit 7113597
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,28 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase
/**
* @var ClassMetadataFactory
*/
private $_factory;
private $cmf;

/**
* {@inheritDoc}
*/
protected function setUp() {
$this->_factory = new ClassMetadataFactory();
$this->_factory->setEntityManager($this->_getTestEntityManager());
$this->cmf = new ClassMetadataFactory();

$this->cmf->setEntityManager($this->_getTestEntityManager());
}

/**
* @expectedException Doctrine\ORM\Mapping\MappingException
*/
public function testGetMetadataForTransientClassThrowsException()
{
$this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\TransientBaseClass');
$this->cmf->getMetadataFor('Doctrine\Tests\ORM\Mapping\TransientBaseClass');
}

public function testGetMetadataForSubclassWithTransientBaseClass()
{
$class = $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\EntitySubClass');
$class = $this->cmf->getMetadataFor('Doctrine\Tests\ORM\Mapping\EntitySubClass');

$this->assertEmpty($class->subClasses);
$this->assertEmpty($class->parentClasses);
Expand All @@ -38,7 +42,7 @@ public function testGetMetadataForSubclassWithTransientBaseClass()

public function testGetMetadataForSubclassWithMappedSuperclass()
{
$class = $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\EntitySubClass2');
$class = $this->cmf->getMetadataFor('Doctrine\Tests\ORM\Mapping\EntitySubClass2');

$this->assertEmpty($class->subClasses);
$this->assertEmpty($class->parentClasses);
Expand All @@ -60,15 +64,15 @@ public function testGetMetadataForSubclassWithMappedSuperclass()
*/
public function testGetMetadataForSubclassWithMappedSuperclassWithRepository()
{
$class = $this->_factory->getMetadataFor('Doctrine\Tests\Models\DDC869\DDC869CreditCardPayment');
$class = $this->cmf->getMetadataFor('Doctrine\Tests\Models\DDC869\DDC869CreditCardPayment');

$this->assertArrayHasKey('id', $class->fieldMappings);
$this->assertArrayHasKey('value', $class->fieldMappings);
$this->assertArrayHasKey('creditCardNumber', $class->fieldMappings);
$this->assertEquals($class->customRepositoryClassName, 'Doctrine\Tests\Models\DDC869\DDC869PaymentRepository');


$class = $this->_factory->getMetadataFor('Doctrine\Tests\Models\DDC869\DDC869ChequePayment');
$class = $this->cmf->getMetadataFor('Doctrine\Tests\Models\DDC869\DDC869ChequePayment');

$this->assertArrayHasKey('id', $class->fieldMappings);
$this->assertArrayHasKey('value', $class->fieldMappings);
Expand All @@ -77,7 +81,7 @@ public function testGetMetadataForSubclassWithMappedSuperclassWithRepository()


// override repositoryClass
$class = $this->_factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\SubclassWithRepository');
$class = $this->cmf->getMetadataFor('Doctrine\Tests\ORM\Mapping\SubclassWithRepository');

$this->assertArrayHasKey('id', $class->fieldMappings);
$this->assertArrayHasKey('value', $class->fieldMappings);
Expand All @@ -90,7 +94,7 @@ public function testGetMetadataForSubclassWithMappedSuperclassWithRepository()
public function testSerializationWithPrivateFieldsFromMappedSuperclass()
{

$class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\EntitySubClass2');
$class = $this->cmf->getMetadataFor(__NAMESPACE__ . '\\EntitySubClass2');

$class2 = unserialize(serialize($class));
$class2->wakeupReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
Expand All @@ -105,7 +109,7 @@ public function testSerializationWithPrivateFieldsFromMappedSuperclass()
*/
public function testUnmappedSuperclassInHierarchy()
{
$class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\HierarchyD');
$class = $this->cmf->getMetadataFor(__NAMESPACE__ . '\\HierarchyD');

$this->assertArrayHasKey('id', $class->fieldMappings);
$this->assertArrayHasKey('a', $class->fieldMappings);
Expand All @@ -119,7 +123,7 @@ public function testUnmappedEntityInHierarchy()
{
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', "Entity 'Doctrine\Tests\ORM\Mapping\HierarchyBEntity' has to be part of the discriminator map of 'Doctrine\Tests\ORM\Mapping\HierarchyBase' to be properly mapped in the inheritance hierarchy. Alternatively you can make 'Doctrine\Tests\ORM\Mapping\HierarchyBEntity' an abstract class to avoid this exception from occurring.");

$this->_factory->getMetadataFor(__NAMESPACE__ . '\\HierarchyE');
$this->cmf->getMetadataFor(__NAMESPACE__ . '\\HierarchyE');
}

/**
Expand All @@ -128,7 +132,7 @@ public function testUnmappedEntityInHierarchy()
*/
public function testMappedSuperclassWithId()
{
$class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\SuperclassEntity');
$class = $this->cmf->getMetadataFor(__NAMESPACE__ . '\\SuperclassEntity');

$this->assertArrayHasKey('id', $class->fieldMappings);
}
Expand All @@ -139,7 +143,7 @@ public function testMappedSuperclassWithId()
*/
public function testGeneratedValueFromMappedSuperclass()
{
$class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\SuperclassEntity');
$class = $this->cmf->getMetadataFor(__NAMESPACE__ . '\\SuperclassEntity');
/* @var $class ClassMetadataInfo */

$this->assertInstanceOf('Doctrine\ORM\Id\SequenceGenerator', $class->idGenerator);
Expand All @@ -152,7 +156,7 @@ public function testGeneratedValueFromMappedSuperclass()
*/
public function testSequenceDefinitionInHierarchyWithSandwichMappedSuperclass()
{
$class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\HierarchyD');
$class = $this->cmf->getMetadataFor(__NAMESPACE__ . '\\HierarchyD');
/* @var $class ClassMetadataInfo */

$this->assertInstanceOf('Doctrine\ORM\Id\SequenceGenerator', $class->idGenerator);
Expand All @@ -165,7 +169,7 @@ public function testSequenceDefinitionInHierarchyWithSandwichMappedSuperclass()
*/
public function testMultipleMappedSuperclasses()
{
$class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\MediumSuperclassEntity');
$class = $this->cmf->getMetadataFor(__NAMESPACE__ . '\\MediumSuperclassEntity');
/* @var $class ClassMetadataInfo */

$this->assertInstanceOf('Doctrine\ORM\Id\SequenceGenerator', $class->idGenerator);
Expand All @@ -179,7 +183,7 @@ public function testMultipleMappedSuperclasses()
*/
public function testMappedSuperclassIndex()
{
$class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\EntityIndexSubClass');
$class = $this->cmf->getMetadataFor(__NAMESPACE__ . '\\EntityIndexSubClass');
/* @var $class ClassMetadataInfo */

$this->assertArrayHasKey('mapped1', $class->fieldMappings);
Expand Down

0 comments on commit 7113597

Please sign in to comment.