1
0
mirror of synced 2025-03-14 00:26:08 +03:00

Added unit test for boolean option values.

It fail now. In `XmlDriver::_parseOptions` we need somehow to maintain
a list of options, that are supposed to be boolean, and then call
`$this->evaluateBoolean()` on them.
This commit is contained in:
Alexander Guz 2016-11-16 17:56:07 +01:00
parent 05e77868ab
commit cdf4af5f27
2 changed files with 10 additions and 2 deletions

View File

@ -34,7 +34,7 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
}
/**
* @expectedException Doctrine\ORM\Cache\CacheException
* @expectedException \Doctrine\ORM\Cache\CacheException
* @expectedExceptionMessage Entity association field "Doctrine\Tests\ORM\Mapping\XMLSLC#foo" not configured as part of the second-level cache.
*/
public function testFailingSecondLevelCacheAssociation()
@ -132,7 +132,7 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
/**
* @group DDC-1468
*
* @expectedException Doctrine\Common\Persistence\Mapping\MappingException
* @expectedException \Doctrine\Common\Persistence\Mapping\MappingException
* @expectedExceptionMessage Invalid mapping file 'Doctrine.Tests.Models.Generic.SerializationModel.dcm.xml' for class 'Doctrine\Tests\Models\Generic\SerializationModel'.
*/
public function testInvalidMappingFileException()
@ -140,6 +140,13 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
$this->createClassMetadata('Doctrine\Tests\Models\Generic\SerializationModel');
}
public function testBooleanValuesForOptionIsSetCorrectly()
{
$class = $this->createClassMetadata('Doctrine\Tests\ORM\Mapping\User');
$this->assertInternalType('bool', $class->fieldMappings['name']['options']['bool_opt']);
$this->assertFalse($class->fieldMappings['name']['options']['bool_opt']);
}
/**
* @param string $xmlMappingFile
* @dataProvider dataValidSchema

View File

@ -50,6 +50,7 @@
<option name="baz">
<option name="key">val</option>
</option>
<option name="bool_opt">false</option>
</options>
</field>
<field name="email" column="user_email" type="string" column-definition="CHAR(32) NOT NULL" />