1
0
mirror of synced 2025-02-02 13:31:45 +03:00

Merge branch 'DDC-3041' into 2.4

This commit is contained in:
Benjamin Eberlei 2014-03-23 10:18:36 +01:00
commit 24c5c54c1e
2 changed files with 22 additions and 1 deletions

View File

@ -193,7 +193,7 @@ class XmlExporter extends AbstractExporter
}
if (isset($field['unique']) && $field['unique']) {
$fieldXml->addAttribute('unique', $field['unique']);
$fieldXml->addAttribute('unique', $field['unique'] ? 'true' : 'false');
}
if (isset($field['options'])) {

View File

@ -209,6 +209,27 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest
return $class;
}
/**
* @depends testExportDirectoryAndFilesAreCreated
*/
public function testFieldsAreProperlySerialized()
{
$type = $this->_getType();
if ($type == 'xml') {
$xml = simplexml_load_file(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml');
$xml->registerXPathNamespace("d", "http://doctrine-project.org/schemas/orm/doctrine-mapping");
$nodes = $xml->xpath("/d:doctrine-mapping/d:entity/d:field[@name='name' and @type='string' and @nullable='true']");
$this->assertEquals(1, count($nodes));
$nodes = $xml->xpath("/d:doctrine-mapping/d:entity/d:field[@name='name' and @type='string' and @unique='true']");
$this->assertEquals(1, count($nodes));
}
else {
$this->markTestSkipped('Test available only for '.$type.' driver');
}
}
/**
* @depends testFieldsAreExported
* @param ClassMetadataInfo $class