From b1e031a1b44554b0b47a143815b01a78bf2fddf3 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Thu, 2 Jan 2014 23:33:49 +0100 Subject: [PATCH] [DDC-2732] Add tests for XML id options fix. --- .../ORM/Mapping/AbstractMappingDriverTest.php | 23 ++++++++++++++++++- .../php/Doctrine.Tests.ORM.Mapping.User.php | 1 + .../Doctrine.Tests.ORM.Mapping.User.dcm.xml | 3 +++ .../Doctrine.Tests.ORM.Mapping.User.dcm.yml | 2 ++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index 28e6f1ede..82fad3b15 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -187,12 +187,32 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase $this->assertTrue($class->fieldMappings['name']['nullable']); $this->assertTrue($class->fieldMappings['name']['unique']); + return $class; + } + + /** + * @depends testEntityTableNameAndInheritance + * @param ClassMetadata $class + */ + public function testFieldOptions($class) + { $expected = array('foo' => 'bar', 'baz' => array('key' => 'val')); $this->assertEquals($expected, $class->fieldMappings['name']['options']); return $class; } + /** + * @depends testEntityTableNameAndInheritance + * @param ClassMetadata $class + */ + public function testIdFieldOptions($class) + { + $this->assertEquals(array('foo' => 'bar'), $class->fieldMappings['id']['options']); + + return $class; + } + /** * @depends testFieldMappings * @param ClassMetadata $class @@ -890,7 +910,7 @@ class User { /** * @Id - * @Column(type="integer") + * @Column(type="integer", options={"foo": "bar"}) * @generatedValue(strategy="AUTO") * @SequenceGenerator(sequenceName="tablename_seq", initialValue=1, allocationSize=100) **/ @@ -971,6 +991,7 @@ class User 'fieldName' => 'id', 'type' => 'integer', 'columnName' => 'id', + 'options' => array('foo' => 'bar'), )); $metadata->mapField(array( 'fieldName' => 'name', diff --git a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php index 815523cc1..1795793d3 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php +++ b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php @@ -19,6 +19,7 @@ $metadata->mapField(array( 'fieldName' => 'id', 'type' => 'integer', 'columnName' => 'id', + 'options' => array('foo' => 'bar'), )); $metadata->mapField(array( 'fieldName' => 'name', diff --git a/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml index f2ef7d814..d7c5f2813 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml +++ b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml @@ -35,6 +35,9 @@ + + + diff --git a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml index 3655db20f..6b87472d1 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml +++ b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml @@ -16,6 +16,8 @@ Doctrine\Tests\ORM\Mapping\User: sequenceName: tablename_seq allocationSize: 100 initialValue: 1 + options: + foo: bar fields: name: type: string