1
0
mirror of synced 2025-01-09 18:47:10 +03:00

[DDC-2732] Add tests for XML id options fix.

This commit is contained in:
Benjamin Eberlei 2014-01-02 23:33:49 +01:00
parent 333177da00
commit b1e031a1b4
4 changed files with 28 additions and 1 deletions

View File

@ -187,12 +187,32 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
$this->assertTrue($class->fieldMappings['name']['nullable']); $this->assertTrue($class->fieldMappings['name']['nullable']);
$this->assertTrue($class->fieldMappings['name']['unique']); $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')); $expected = array('foo' => 'bar', 'baz' => array('key' => 'val'));
$this->assertEquals($expected, $class->fieldMappings['name']['options']); $this->assertEquals($expected, $class->fieldMappings['name']['options']);
return $class; return $class;
} }
/**
* @depends testEntityTableNameAndInheritance
* @param ClassMetadata $class
*/
public function testIdFieldOptions($class)
{
$this->assertEquals(array('foo' => 'bar'), $class->fieldMappings['id']['options']);
return $class;
}
/** /**
* @depends testFieldMappings * @depends testFieldMappings
* @param ClassMetadata $class * @param ClassMetadata $class
@ -890,7 +910,7 @@ class User
{ {
/** /**
* @Id * @Id
* @Column(type="integer") * @Column(type="integer", options={"foo": "bar"})
* @generatedValue(strategy="AUTO") * @generatedValue(strategy="AUTO")
* @SequenceGenerator(sequenceName="tablename_seq", initialValue=1, allocationSize=100) * @SequenceGenerator(sequenceName="tablename_seq", initialValue=1, allocationSize=100)
**/ **/
@ -971,6 +991,7 @@ class User
'fieldName' => 'id', 'fieldName' => 'id',
'type' => 'integer', 'type' => 'integer',
'columnName' => 'id', 'columnName' => 'id',
'options' => array('foo' => 'bar'),
)); ));
$metadata->mapField(array( $metadata->mapField(array(
'fieldName' => 'name', 'fieldName' => 'name',

View File

@ -19,6 +19,7 @@ $metadata->mapField(array(
'fieldName' => 'id', 'fieldName' => 'id',
'type' => 'integer', 'type' => 'integer',
'columnName' => 'id', 'columnName' => 'id',
'options' => array('foo' => 'bar'),
)); ));
$metadata->mapField(array( $metadata->mapField(array(
'fieldName' => 'name', 'fieldName' => 'name',

View File

@ -35,6 +35,9 @@
<id name="id" type="integer" column="id"> <id name="id" type="integer" column="id">
<generator strategy="AUTO"/> <generator strategy="AUTO"/>
<sequence-generator sequence-name="tablename_seq" allocation-size="100" initial-value="1" /> <sequence-generator sequence-name="tablename_seq" allocation-size="100" initial-value="1" />
<options>
<option name="foo">bar</option>
</options>
</id> </id>
<field name="name" column="name" type="string" length="50" nullable="true" unique="true"> <field name="name" column="name" type="string" length="50" nullable="true" unique="true">

View File

@ -16,6 +16,8 @@ Doctrine\Tests\ORM\Mapping\User:
sequenceName: tablename_seq sequenceName: tablename_seq
allocationSize: 100 allocationSize: 100
initialValue: 1 initialValue: 1
options:
foo: bar
fields: fields:
name: name:
type: string type: string