DDC-3120 - need to wakeup reflection BEFORE using any ClassMetadata
API
This commit is contained in:
parent
c2993bcdeb
commit
f8a8437c95
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
namespace Doctrine\Tests\ORM\Mapping;
|
namespace Doctrine\Tests\ORM\Mapping;
|
||||||
|
|
||||||
|
use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
use Doctrine\ORM\Events;
|
use Doctrine\ORM\Events;
|
||||||
|
use Doctrine\ORM\Mapping\DefaultNamingStrategy;
|
||||||
|
|
||||||
require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
|
require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
|
||||||
|
|
||||||
@ -12,7 +14,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testClassMetadataInstanceSerialization()
|
public function testClassMetadataInstanceSerialization()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
// Test initial state
|
// Test initial state
|
||||||
$this->assertTrue(count($cm->getReflectionProperties()) == 0);
|
$this->assertTrue(count($cm->getReflectionProperties()) == 0);
|
||||||
@ -36,7 +38,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
|
|
||||||
$serialized = serialize($cm);
|
$serialized = serialize($cm);
|
||||||
$cm = unserialize($serialized);
|
$cm = unserialize($serialized);
|
||||||
$cm->wakeupReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->wakeupReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
// Check state
|
// Check state
|
||||||
$this->assertTrue(count($cm->getReflectionProperties()) > 0);
|
$this->assertTrue(count($cm->getReflectionProperties()) > 0);
|
||||||
@ -61,7 +63,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testFieldIsNullable()
|
public function testFieldIsNullable()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
// Explicit Nullable
|
// Explicit Nullable
|
||||||
$cm->mapField(array('fieldName' => 'status', 'nullable' => true, 'type' => 'string', 'length' => 50));
|
$cm->mapField(array('fieldName' => 'status', 'nullable' => true, 'type' => 'string', 'length' => 50));
|
||||||
@ -84,7 +86,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
require_once __DIR__."/../../Models/Global/GlobalNamespaceModel.php";
|
require_once __DIR__."/../../Models/Global/GlobalNamespaceModel.php";
|
||||||
|
|
||||||
$cm = new ClassMetadata('DoctrineGlobal_Article');
|
$cm = new ClassMetadata('DoctrineGlobal_Article');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->mapManyToMany(array(
|
$cm->mapManyToMany(array(
|
||||||
'fieldName' => 'author',
|
'fieldName' => 'author',
|
||||||
'targetEntity' => 'DoctrineGlobal_User',
|
'targetEntity' => 'DoctrineGlobal_User',
|
||||||
@ -101,7 +103,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testMapManyToManyJoinTableDefaults()
|
public function testMapManyToManyJoinTableDefaults()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->mapManyToMany(
|
$cm->mapManyToMany(
|
||||||
array(
|
array(
|
||||||
'fieldName' => 'groups',
|
'fieldName' => 'groups',
|
||||||
@ -121,7 +123,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testSerializeManyToManyJoinTableCascade()
|
public function testSerializeManyToManyJoinTableCascade()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->mapManyToMany(
|
$cm->mapManyToMany(
|
||||||
array(
|
array(
|
||||||
'fieldName' => 'groups',
|
'fieldName' => 'groups',
|
||||||
@ -143,7 +145,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
require_once __DIR__."/../../Models/Global/GlobalNamespaceModel.php";
|
require_once __DIR__."/../../Models/Global/GlobalNamespaceModel.php";
|
||||||
|
|
||||||
$cm = new ClassMetadata('DoctrineGlobal_User');
|
$cm = new ClassMetadata('DoctrineGlobal_User');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->setDiscriminatorMap(array('descr' => 'DoctrineGlobal_Article', 'foo' => 'DoctrineGlobal_User'));
|
$cm->setDiscriminatorMap(array('descr' => 'DoctrineGlobal_Article', 'foo' => 'DoctrineGlobal_User'));
|
||||||
|
|
||||||
$this->assertEquals("DoctrineGlobal_Article", $cm->discriminatorMap['descr']);
|
$this->assertEquals("DoctrineGlobal_Article", $cm->discriminatorMap['descr']);
|
||||||
@ -158,7 +160,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
require_once __DIR__."/../../Models/Global/GlobalNamespaceModel.php";
|
require_once __DIR__."/../../Models/Global/GlobalNamespaceModel.php";
|
||||||
|
|
||||||
$cm = new ClassMetadata('DoctrineGlobal_User');
|
$cm = new ClassMetadata('DoctrineGlobal_User');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->setSubclasses(array('DoctrineGlobal_Article'));
|
$cm->setSubclasses(array('DoctrineGlobal_Article'));
|
||||||
|
|
||||||
$this->assertEquals("DoctrineGlobal_Article", $cm->subClasses[0]);
|
$this->assertEquals("DoctrineGlobal_Article", $cm->subClasses[0]);
|
||||||
@ -174,7 +176,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$field['type'] = 'string';
|
$field['type'] = 'string';
|
||||||
|
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException');
|
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException');
|
||||||
$cm->setVersionMapping($field);
|
$cm->setVersionMapping($field);
|
||||||
@ -183,7 +185,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testGetSingleIdentifierFieldName_MultipleIdentifierEntity_ThrowsException()
|
public function testGetSingleIdentifierFieldName_MultipleIdentifierEntity_ThrowsException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->isIdentifierComposite = true;
|
$cm->isIdentifierComposite = true;
|
||||||
|
|
||||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException');
|
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException');
|
||||||
@ -193,7 +195,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testDuplicateAssociationMappingException()
|
public function testDuplicateAssociationMappingException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$a1 = array('fieldName' => 'foo', 'sourceEntity' => 'stdClass', 'targetEntity' => 'stdClass', 'mappedBy' => 'foo');
|
$a1 = array('fieldName' => 'foo', 'sourceEntity' => 'stdClass', 'targetEntity' => 'stdClass', 'mappedBy' => 'foo');
|
||||||
$a2 = array('fieldName' => 'foo', 'sourceEntity' => 'stdClass', 'targetEntity' => 'stdClass', 'mappedBy' => 'foo');
|
$a2 = array('fieldName' => 'foo', 'sourceEntity' => 'stdClass', 'targetEntity' => 'stdClass', 'mappedBy' => 'foo');
|
||||||
@ -206,7 +208,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testDuplicateColumnName_ThrowsMappingException()
|
public function testDuplicateColumnName_ThrowsMappingException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->mapField(array('fieldName' => 'name', 'columnName' => 'name'));
|
$cm->mapField(array('fieldName' => 'name', 'columnName' => 'name'));
|
||||||
|
|
||||||
@ -217,7 +219,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testDuplicateColumnName_DiscriminatorColumn_ThrowsMappingException()
|
public function testDuplicateColumnName_DiscriminatorColumn_ThrowsMappingException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->mapField(array('fieldName' => 'name', 'columnName' => 'name'));
|
$cm->mapField(array('fieldName' => 'name', 'columnName' => 'name'));
|
||||||
|
|
||||||
@ -228,7 +230,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testDuplicateColumnName_DiscriminatorColumn2_ThrowsMappingException()
|
public function testDuplicateColumnName_DiscriminatorColumn2_ThrowsMappingException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->setDiscriminatorColumn(array('name' => 'name'));
|
$cm->setDiscriminatorColumn(array('name' => 'name'));
|
||||||
|
|
||||||
@ -239,7 +241,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testDuplicateFieldAndAssociationMapping1_ThrowsException()
|
public function testDuplicateFieldAndAssociationMapping1_ThrowsException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->mapField(array('fieldName' => 'name', 'columnName' => 'name'));
|
$cm->mapField(array('fieldName' => 'name', 'columnName' => 'name'));
|
||||||
|
|
||||||
@ -250,7 +252,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testDuplicateFieldAndAssociationMapping2_ThrowsException()
|
public function testDuplicateFieldAndAssociationMapping2_ThrowsException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->mapOneToOne(array('fieldName' => 'name', 'targetEntity' => 'CmsUser'));
|
$cm->mapOneToOne(array('fieldName' => 'name', 'targetEntity' => 'CmsUser'));
|
||||||
|
|
||||||
@ -264,7 +266,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testGetTemporaryTableNameSchema()
|
public function testGetTemporaryTableNameSchema()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->setTableName('foo.bar');
|
$cm->setTableName('foo.bar');
|
||||||
|
|
||||||
@ -274,7 +276,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testDefaultTableName()
|
public function testDefaultTableName()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
// When table's name is not given
|
// When table's name is not given
|
||||||
$primaryTable = array();
|
$primaryTable = array();
|
||||||
@ -284,7 +286,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$this->assertEquals('CmsUser', $cm->table['name']);
|
$this->assertEquals('CmsUser', $cm->table['name']);
|
||||||
|
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
// When joinTable's name is not given
|
// When joinTable's name is not given
|
||||||
$cm->mapManyToMany(array(
|
$cm->mapManyToMany(array(
|
||||||
'fieldName' => 'user',
|
'fieldName' => 'user',
|
||||||
@ -298,7 +300,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testDefaultJoinColumnName()
|
public function testDefaultJoinColumnName()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
// this is really dirty, but it's the simplest way to test whether
|
// this is really dirty, but it's the simplest way to test whether
|
||||||
// joinColumn's name will be automatically set to user_id
|
// joinColumn's name will be automatically set to user_id
|
||||||
@ -309,7 +311,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$this->assertEquals('user_id', $cm->associationMappings['user']['joinColumns'][0]['name']);
|
$this->assertEquals('user_id', $cm->associationMappings['user']['joinColumns'][0]['name']);
|
||||||
|
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->mapManyToMany(array(
|
$cm->mapManyToMany(array(
|
||||||
'fieldName' => 'user',
|
'fieldName' => 'user',
|
||||||
'targetEntity' => 'CmsUser',
|
'targetEntity' => 'CmsUser',
|
||||||
@ -372,7 +374,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testSetMultipleIdentifierSetsComposite()
|
public function testSetMultipleIdentifierSetsComposite()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->mapField(array('fieldName' => 'name'));
|
$cm->mapField(array('fieldName' => 'name'));
|
||||||
$cm->mapField(array('fieldName' => 'username'));
|
$cm->mapField(array('fieldName' => 'username'));
|
||||||
@ -387,7 +389,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testMappingNotFound()
|
public function testMappingNotFound()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', "No mapping found for field 'foo' on class 'Doctrine\Tests\Models\CMS\CmsUser'.");
|
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', "No mapping found for field 'foo' on class 'Doctrine\Tests\Models\CMS\CmsUser'.");
|
||||||
$cm->getFieldMapping('foo');
|
$cm->getFieldMapping('foo');
|
||||||
@ -399,7 +401,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testJoinTableMappingDefaults()
|
public function testJoinTableMappingDefaults()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('DoctrineGlobal_Article');
|
$cm = new ClassMetadata('DoctrineGlobal_Article');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->mapManyToMany(array('fieldName' => 'author', 'targetEntity' => 'Doctrine\Tests\Models\CMS\CmsUser'));
|
$cm->mapManyToMany(array('fieldName' => 'author', 'targetEntity' => 'Doctrine\Tests\Models\CMS\CmsUser'));
|
||||||
|
|
||||||
@ -412,7 +414,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testMapIdentifierAssociation()
|
public function testMapIdentifierAssociation()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->mapOneToOne(array(
|
$cm->mapOneToOne(array(
|
||||||
'fieldName' => 'article',
|
'fieldName' => 'article',
|
||||||
@ -431,7 +433,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testOrphanRemovalIdentifierAssociation()
|
public function testOrphanRemovalIdentifierAssociation()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', 'The orphan removal option is not allowed on an association that');
|
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', 'The orphan removal option is not allowed on an association that');
|
||||||
$cm->mapOneToOne(array(
|
$cm->mapOneToOne(array(
|
||||||
@ -449,7 +451,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testInverseIdentifierAssociation()
|
public function testInverseIdentifierAssociation()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
|
|
||||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', 'An inverse association is not allowed to be identifier in');
|
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', 'An inverse association is not allowed to be identifier in');
|
||||||
@ -468,7 +470,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testIdentifierAssociationManyToMany()
|
public function testIdentifierAssociationManyToMany()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC117\DDC117ArticleDetails');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
|
|
||||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', 'Many-to-many or one-to-many associations are not allowed to be identifier in');
|
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', 'Many-to-many or one-to-many associations are not allowed to be identifier in');
|
||||||
@ -488,7 +490,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException',
|
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException',
|
||||||
"The field or association mapping misses the 'fieldName' attribute in entity 'Doctrine\Tests\Models\CMS\CmsUser'.");
|
"The field or association mapping misses the 'fieldName' attribute in entity 'Doctrine\Tests\Models\CMS\CmsUser'.");
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->mapField(array('fieldName' => ''));
|
$cm->mapField(array('fieldName' => ''));
|
||||||
}
|
}
|
||||||
@ -496,7 +498,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testRetrievalOfNamedQueries()
|
public function testRetrievalOfNamedQueries()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
|
|
||||||
$this->assertEquals(0, count($cm->getNamedQueries()));
|
$this->assertEquals(0, count($cm->getNamedQueries()));
|
||||||
@ -515,7 +517,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testRetrievalOfResultSetMappings()
|
public function testRetrievalOfResultSetMappings()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
|
|
||||||
$this->assertEquals(0, count($cm->getSqlResultSetMappings()));
|
$this->assertEquals(0, count($cm->getSqlResultSetMappings()));
|
||||||
@ -535,7 +537,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testExistanceOfNamedQuery()
|
public function testExistanceOfNamedQuery()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
|
|
||||||
$cm->addNamedQuery(array(
|
$cm->addNamedQuery(array(
|
||||||
@ -553,7 +555,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testRetrieveOfNamedNativeQuery()
|
public function testRetrieveOfNamedNativeQuery()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->addNamedNativeQuery(array(
|
$cm->addNamedNativeQuery(array(
|
||||||
'name' => 'find-all',
|
'name' => 'find-all',
|
||||||
@ -586,7 +588,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testRetrieveOfSqlResultSetMapping()
|
public function testRetrieveOfSqlResultSetMapping()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->addSqlResultSetMapping(array(
|
$cm->addSqlResultSetMapping(array(
|
||||||
'name' => 'find-all',
|
'name' => 'find-all',
|
||||||
@ -644,7 +646,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testExistanceOfSqlResultSetMapping()
|
public function testExistanceOfSqlResultSetMapping()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->addSqlResultSetMapping(array(
|
$cm->addSqlResultSetMapping(array(
|
||||||
'name' => 'find-all',
|
'name' => 'find-all',
|
||||||
@ -665,7 +667,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testExistanceOfNamedNativeQuery()
|
public function testExistanceOfNamedNativeQuery()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
|
|
||||||
$cm->addNamedNativeQuery(array(
|
$cm->addNamedNativeQuery(array(
|
||||||
@ -682,7 +684,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testRetrieveOfNamedQuery()
|
public function testRetrieveOfNamedQuery()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
|
|
||||||
$cm->addNamedQuery(array(
|
$cm->addNamedQuery(array(
|
||||||
@ -699,7 +701,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testRetrievalOfNamedNativeQueries()
|
public function testRetrievalOfNamedNativeQueries()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$this->assertEquals(0, count($cm->getNamedNativeQueries()));
|
$this->assertEquals(0, count($cm->getNamedNativeQueries()));
|
||||||
|
|
||||||
@ -720,7 +722,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
{
|
{
|
||||||
$metadata = new ClassMetadata('Doctrine\Tests\Models\Company\CompanyContract');
|
$metadata = new ClassMetadata('Doctrine\Tests\Models\Company\CompanyContract');
|
||||||
|
|
||||||
$metadata->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$metadata->initializeReflection(new RuntimeReflectionService());
|
||||||
$metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CompanyContractListener', 'prePersistHandler');
|
$metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CompanyContractListener', 'prePersistHandler');
|
||||||
$metadata->addEntityListener(\Doctrine\ORM\Events::postPersist, 'CompanyContractListener', 'postPersistHandler');
|
$metadata->addEntityListener(\Doctrine\ORM\Events::postPersist, 'CompanyContractListener', 'postPersistHandler');
|
||||||
|
|
||||||
@ -737,7 +739,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testNamingCollisionNamedQueryShouldThrowException()
|
public function testNamingCollisionNamedQueryShouldThrowException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->addNamedQuery(array(
|
$cm->addNamedQuery(array(
|
||||||
'name' => 'userById',
|
'name' => 'userById',
|
||||||
@ -759,7 +761,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testNamingCollisionNamedNativeQueryShouldThrowException()
|
public function testNamingCollisionNamedNativeQueryShouldThrowException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->addNamedNativeQuery(array(
|
$cm->addNamedNativeQuery(array(
|
||||||
'name' => 'find-all',
|
'name' => 'find-all',
|
||||||
@ -785,7 +787,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testNamingCollisionSqlResultSetMappingShouldThrowException()
|
public function testNamingCollisionSqlResultSetMappingShouldThrowException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->addSqlResultSetMapping(array(
|
$cm->addSqlResultSetMapping(array(
|
||||||
'name' => 'find-all',
|
'name' => 'find-all',
|
||||||
@ -813,7 +815,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
{
|
{
|
||||||
$user = new \Doctrine\Tests\Models\CMS\CmsUser();
|
$user = new \Doctrine\Tests\Models\CMS\CmsUser();
|
||||||
$cm = new ClassMetadata('DOCTRINE\TESTS\MODELS\CMS\CMSUSER');
|
$cm = new ClassMetadata('DOCTRINE\TESTS\MODELS\CMS\CMSUSER');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name);
|
$this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name);
|
||||||
}
|
}
|
||||||
@ -824,11 +826,11 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testLifecycleCallbackNotFound()
|
public function testLifecycleCallbackNotFound()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->addLifecycleCallback('notfound', 'postLoad');
|
$cm->addLifecycleCallback('notfound', 'postLoad');
|
||||||
|
|
||||||
$this->setExpectedException("Doctrine\ORM\Mapping\MappingException", "Entity 'Doctrine\Tests\Models\CMS\CmsUser' has no method 'notfound' to be registered as lifecycle callback.");
|
$this->setExpectedException("Doctrine\ORM\Mapping\MappingException", "Entity 'Doctrine\Tests\Models\CMS\CmsUser' has no method 'notfound' to be registered as lifecycle callback.");
|
||||||
$cm->validateLifecycleCallbacks(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->validateLifecycleCallbacks(new RuntimeReflectionService());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -837,7 +839,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testTargetEntityNotFound()
|
public function testTargetEntityNotFound()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->mapManyToOne(array('fieldName' => 'address', 'targetEntity' => 'UnknownClass'));
|
$cm->mapManyToOne(array('fieldName' => 'address', 'targetEntity' => 'UnknownClass'));
|
||||||
|
|
||||||
$this->setExpectedException("Doctrine\ORM\Mapping\MappingException", "The target-entity Doctrine\Tests\Models\CMS\UnknownClass cannot be found in 'Doctrine\Tests\Models\CMS\CmsUser#address'.");
|
$this->setExpectedException("Doctrine\ORM\Mapping\MappingException", "The target-entity Doctrine\Tests\Models\CMS\UnknownClass cannot be found in 'Doctrine\Tests\Models\CMS\CmsUser#address'.");
|
||||||
@ -853,7 +855,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testNameIsMandatoryForNamedQueryMappingException()
|
public function testNameIsMandatoryForNamedQueryMappingException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->addNamedQuery(array(
|
$cm->addNamedQuery(array(
|
||||||
'query' => 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
'query' => 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
||||||
));
|
));
|
||||||
@ -868,7 +870,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testNameIsMandatoryForNameNativeQueryMappingException()
|
public function testNameIsMandatoryForNameNativeQueryMappingException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->addNamedQuery(array(
|
$cm->addNamedQuery(array(
|
||||||
'query' => 'SELECT * FROM cms_users',
|
'query' => 'SELECT * FROM cms_users',
|
||||||
'resultClass' => 'Doctrine\Tests\Models\CMS\CmsUser',
|
'resultClass' => 'Doctrine\Tests\Models\CMS\CmsUser',
|
||||||
@ -885,7 +887,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testNameIsMandatoryForEntityNameSqlResultSetMappingException()
|
public function testNameIsMandatoryForEntityNameSqlResultSetMappingException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->addSqlResultSetMapping(array(
|
$cm->addSqlResultSetMapping(array(
|
||||||
'name' => 'find-all',
|
'name' => 'find-all',
|
||||||
'entities' => array(
|
'entities' => array(
|
||||||
@ -903,7 +905,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testNameIsMandatoryForDiscriminatorColumnsMappingException()
|
public function testNameIsMandatoryForDiscriminatorColumnsMappingException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->setDiscriminatorColumn(array());
|
$cm->setDiscriminatorColumn(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,9 +921,9 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$articleMetadata = new ClassMetadata('DoctrineGlobal_Article', $namingStrategy);
|
$articleMetadata = new ClassMetadata('DoctrineGlobal_Article', $namingStrategy);
|
||||||
$routingMetadata = new ClassMetadata('Doctrine\Tests\Models\Routing\RoutingLeg',$namingStrategy);
|
$routingMetadata = new ClassMetadata('Doctrine\Tests\Models\Routing\RoutingLeg',$namingStrategy);
|
||||||
|
|
||||||
$addressMetadata->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$addressMetadata->initializeReflection(new RuntimeReflectionService());
|
||||||
$articleMetadata->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$articleMetadata->initializeReflection(new RuntimeReflectionService());
|
||||||
$routingMetadata->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$routingMetadata->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$addressMetadata->mapManyToMany(array(
|
$addressMetadata->mapManyToMany(array(
|
||||||
'fieldName' => 'user',
|
'fieldName' => 'user',
|
||||||
@ -947,7 +949,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$namingStrategy = new MyPrefixNamingStrategy();
|
$namingStrategy = new MyPrefixNamingStrategy();
|
||||||
$metadata = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress', $namingStrategy);
|
$metadata = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress', $namingStrategy);
|
||||||
|
|
||||||
$metadata->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$metadata->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$metadata->mapField(array('fieldName'=>'country'));
|
$metadata->mapField(array('fieldName'=>'country'));
|
||||||
$metadata->mapField(array('fieldName'=>'city'));
|
$metadata->mapField(array('fieldName'=>'city'));
|
||||||
@ -964,7 +966,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testInvalidCascade()
|
public function testInvalidCascade()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$this->setExpectedException("Doctrine\ORM\Mapping\MappingException", "You have specified invalid cascade options for Doctrine\Tests\Models\CMS\CmsUser::\$address: 'invalid'; available options: 'remove', 'persist', 'refresh', 'merge', and 'detach'");
|
$this->setExpectedException("Doctrine\ORM\Mapping\MappingException", "You have specified invalid cascade options for Doctrine\Tests\Models\CMS\CmsUser::\$address: 'invalid'; available options: 'remove', 'persist', 'refresh', 'merge', and 'detach'");
|
||||||
|
|
||||||
@ -980,7 +982,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testInvalidPropertyAssociationOverrideNameException()
|
public function testInvalidPropertyAssociationOverrideNameException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC964\DDC964Admin');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC964\DDC964Admin');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->mapManyToOne(array('fieldName' => 'address', 'targetEntity' => 'DDC964Address'));
|
$cm->mapManyToOne(array('fieldName' => 'address', 'targetEntity' => 'DDC964Address'));
|
||||||
|
|
||||||
$cm->setAssociationOverride('invalidPropertyName', array());
|
$cm->setAssociationOverride('invalidPropertyName', array());
|
||||||
@ -994,7 +996,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testInvalidPropertyAttributeOverrideNameException()
|
public function testInvalidPropertyAttributeOverrideNameException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC964\DDC964Guest');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC964\DDC964Guest');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->mapField(array('fieldName' => 'name'));
|
$cm->mapField(array('fieldName' => 'name'));
|
||||||
|
|
||||||
$cm->setAttributeOverride('invalidPropertyName', array());
|
$cm->setAttributeOverride('invalidPropertyName', array());
|
||||||
@ -1008,7 +1010,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testInvalidOverrideAttributeFieldTypeException()
|
public function testInvalidOverrideAttributeFieldTypeException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC964\DDC964Guest');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\DDC964\DDC964Guest');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->mapField(array('fieldName' => 'name', 'type'=>'string'));
|
$cm->mapField(array('fieldName' => 'name', 'type'=>'string'));
|
||||||
|
|
||||||
$cm->setAttributeOverride('name', array('type'=>'date'));
|
$cm->setAttributeOverride('name', array('type'=>'date'));
|
||||||
@ -1023,7 +1025,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testInvalidEntityListenerClassException()
|
public function testInvalidEntityListenerClassException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->addEntityListener(Events::postLoad, '\InvalidClassName', 'postLoadHandler');
|
$cm->addEntityListener(Events::postLoad, '\InvalidClassName', 'postLoadHandler');
|
||||||
}
|
}
|
||||||
@ -1037,7 +1039,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testInvalidEntityListenerMethodException()
|
public function testInvalidEntityListenerMethodException()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->addEntityListener(Events::postLoad, '\Doctrine\Tests\Models\Company\CompanyContractListener', 'invalidMethod');
|
$cm->addEntityListener(Events::postLoad, '\Doctrine\Tests\Models\Company\CompanyContractListener', 'invalidMethod');
|
||||||
}
|
}
|
||||||
@ -1045,7 +1047,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testManyToManySelfReferencingNamingStrategyDefaults()
|
public function testManyToManySelfReferencingNamingStrategyDefaults()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CustomType\CustomTypeParent');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CustomType\CustomTypeParent');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
$cm->mapManyToMany(
|
$cm->mapManyToMany(
|
||||||
array(
|
array(
|
||||||
'fieldName' => 'friendsWithMe',
|
'fieldName' => 'friendsWithMe',
|
||||||
@ -1072,7 +1074,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testSetSequenceGeneratorThrowsExceptionWhenSequenceNameIsMissing()
|
public function testSetSequenceGeneratorThrowsExceptionWhenSequenceNameIsMissing()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException');
|
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException');
|
||||||
$cm->setSequenceGeneratorDefinition(array());
|
$cm->setSequenceGeneratorDefinition(array());
|
||||||
@ -1084,7 +1086,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testQuotedSequenceName()
|
public function testQuotedSequenceName()
|
||||||
{
|
{
|
||||||
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
$cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
|
$cm->initializeReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$cm->setSequenceGeneratorDefinition(array('sequenceName' => '`foo`'));
|
$cm->setSequenceGeneratorDefinition(array('sequenceName' => '`foo`'));
|
||||||
|
|
||||||
@ -1119,6 +1121,8 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
/* @var $classMetadata ClassMetadata */
|
/* @var $classMetadata ClassMetadata */
|
||||||
$classMetadata = unserialize(serialize(new ClassMetadata(__NAMESPACE__ . '\\MyArrayObjectEntity')));
|
$classMetadata = unserialize(serialize(new ClassMetadata(__NAMESPACE__ . '\\MyArrayObjectEntity')));
|
||||||
|
|
||||||
|
$classMetadata->wakeupReflection(new RuntimeReflectionService());
|
||||||
|
|
||||||
$this->assertInstanceOf(__NAMESPACE__ . '\\MyArrayObjectEntity', $classMetadata->newInstance());
|
$this->assertInstanceOf(__NAMESPACE__ . '\\MyArrayObjectEntity', $classMetadata->newInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1132,7 +1136,7 @@ class DDC2700MappedSuperClass
|
|||||||
private $foo;
|
private $foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyNamespacedNamingStrategy extends \Doctrine\ORM\Mapping\DefaultNamingStrategy
|
class MyNamespacedNamingStrategy extends DefaultNamingStrategy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
@ -1147,7 +1151,7 @@ class MyNamespacedNamingStrategy extends \Doctrine\ORM\Mapping\DefaultNamingStra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyPrefixNamingStrategy extends \Doctrine\ORM\Mapping\DefaultNamingStrategy
|
class MyPrefixNamingStrategy extends DefaultNamingStrategy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user