Adding tests for the attribute use-column-prefix
This commit is contained in:
parent
4935da138d
commit
bacadbf366
10
tests/Doctrine/Tests/Models/DDC3293/DDC3293Address.php
Normal file
10
tests/Doctrine/Tests/Models/DDC3293/DDC3293Address.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Doctrine\Tests\Models\DDC3293;
|
||||||
|
|
||||||
|
class DDC3293Address
|
||||||
|
{
|
||||||
|
public $street;
|
||||||
|
public $city;
|
||||||
|
public $country;
|
||||||
|
}
|
16
tests/Doctrine/Tests/Models/DDC3293/DDC3293User.php
Normal file
16
tests/Doctrine/Tests/Models/DDC3293/DDC3293User.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Doctrine\Tests\Models\DDC3293;
|
||||||
|
|
||||||
|
class DDC3293User
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Doctrine\Tests\Models\DDC3293\DDC3293Address
|
||||||
|
*/
|
||||||
|
protected $address;
|
||||||
|
}
|
16
tests/Doctrine/Tests/Models/DDC3293/DDC3293UserPrefixed.php
Normal file
16
tests/Doctrine/Tests/Models/DDC3293/DDC3293UserPrefixed.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Doctrine\Tests\Models\DDC3293;
|
||||||
|
|
||||||
|
class DDC3293UserPrefixed
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Doctrine\Tests\Models\DDC3293\DDC3293Address
|
||||||
|
*/
|
||||||
|
protected $address;
|
||||||
|
}
|
@ -57,6 +57,25 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
|
|||||||
$this->assertEquals(true, $class->isEmbeddedClass);
|
$this->assertEquals(true, $class->isEmbeddedClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testEmbeddedUseColumnPrefix()
|
||||||
|
{
|
||||||
|
$em = $this->_getTestEntityManager();
|
||||||
|
$em->getConfiguration()->setMetadataDriverImpl($this->_loadDriver());
|
||||||
|
|
||||||
|
$factory = new ClassMetadataFactory();
|
||||||
|
$factory->setEntityManager($em);
|
||||||
|
|
||||||
|
$class = $factory->getMetadataFor('Doctrine\Tests\Models\DDC3293\DDC3293User');
|
||||||
|
$this->assertFalse($class->embeddedClasses['address']['columnPrefix']);
|
||||||
|
|
||||||
|
$class = $factory->getMetadataFor('Doctrine\Tests\Models\DDC3293\DDC3293UserPrefixed');
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'__prefix__',
|
||||||
|
$class->embeddedClasses['address']['columnPrefix']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testEmbeddedMapping()
|
public function testEmbeddedMapping()
|
||||||
{
|
{
|
||||||
$class = $this->createClassMetadata('Doctrine\Tests\Models\ValueObjects\Person');
|
$class = $this->createClassMetadata('Doctrine\Tests\Models\ValueObjects\Person');
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<doctrine-mapping
|
||||||
|
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
|
||||||
|
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
|
||||||
|
<embeddable name="Doctrine\Tests\Models\DDC3293\DDC3293Address">
|
||||||
|
<field name="street" type="string" />
|
||||||
|
<field name="city" type="string" />
|
||||||
|
<field name="country" type="string" />
|
||||||
|
</embeddable>
|
||||||
|
</doctrine-mapping>
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<doctrine-mapping
|
||||||
|
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
|
||||||
|
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
|
||||||
|
<entity name="Doctrine\Tests\Models\DDC3293\DDC3293User" table="user">
|
||||||
|
<id name="id" column="id">
|
||||||
|
<generator strategy="UUID" />
|
||||||
|
</id>
|
||||||
|
<embedded
|
||||||
|
name="address"
|
||||||
|
class="Doctrine\Tests\Models\DDC3293\DDC3293Address"
|
||||||
|
column-prefix="__prefix__"
|
||||||
|
use-column-prefix="false" />
|
||||||
|
</entity>
|
||||||
|
</doctrine-mapping>
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<doctrine-mapping
|
||||||
|
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
|
||||||
|
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
|
||||||
|
<entity name="Doctrine\Tests\Models\DDC3293\DDC3293UserPrefixed" table="user">
|
||||||
|
<id name="id" column="id">
|
||||||
|
<generator strategy="UUID" />
|
||||||
|
</id>
|
||||||
|
<embedded
|
||||||
|
name="address"
|
||||||
|
class="Doctrine\Tests\Models\DDC3293\DDC3293Address"
|
||||||
|
column-prefix="__prefix__"
|
||||||
|
use-column-prefix="true" />
|
||||||
|
</entity>
|
||||||
|
</doctrine-mapping>
|
Loading…
x
Reference in New Issue
Block a user