Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#6129 Added unit test for boolean option values. #6130

Merged
merged 4 commits into from
Nov 17, 2016

Conversation

kalimatas
Copy link

It fails 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.

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.
@Ocramius
Copy link
Member

Ref: #6129

@Ocramius Ocramius changed the title Added unit test for boolean option values. #6129 Added unit test for boolean option values. Nov 16, 2016
* @expectedExceptionMessage Invalid mapping file 'Doctrine.Tests.Models.Generic.SerializationModel.dcm.xml' for class 'Doctrine\Tests\Models\Generic\SerializationModel'.
*/
public function testInvalidMappingFileException()
{
$this->createClassMetadata('Doctrine\Tests\Models\Generic\SerializationModel');
}

public function testBooleanValuesForOptionIsSetCorrectly()
{
$class = $this->createClassMetadata('Doctrine\Tests\ORM\Mapping\User');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use ::class for new code

* @expectedExceptionMessage Invalid mapping file 'Doctrine.Tests.Models.Generic.SerializationModel.dcm.xml' for class 'Doctrine\Tests\Models\Generic\SerializationModel'.
*/
public function testInvalidMappingFileException()
{
$this->createClassMetadata('Doctrine\Tests\Models\Generic\SerializationModel');
}

public function testBooleanValuesForOptionIsSetCorrectly()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add an /** @group #6129 */ or similar?

@Ocramius Ocramius added the Bug label Nov 16, 2016
@Ocramius
Copy link
Member

@kalimatas thanks for converting it into an actual failing scenario!

@@ -653,6 +653,8 @@ private function _parseOptions(SimpleXMLElement $options)
{
$array = array();

$booleanOptions = ['unsigned', 'fixed'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this constant is not used anywhere else, it can be inlined into the in_array() call

@@ -664,7 +666,10 @@ private function _parseOptions(SimpleXMLElement $options)
$attr = $option->attributes();

if (isset($attr->name)) {
$array[(string) $attr->name] = $value;
$attrName = (string) $attr->name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't abbreviate. I know the previous code did, but we should really call it $attributeName or such

@@ -245,6 +248,26 @@ public function testIdentifier($class)
}

/**
* @group #6129
*
* @depends testIdentifier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need @depends

@Ocramius Ocramius added this to the 2.6.0 milestone Nov 17, 2016
@Ocramius Ocramius self-assigned this Nov 17, 2016
@kalimatas
Copy link
Author

@Ocramius fixed

@Ocramius
Copy link
Member

@kalimatas thanks! This looks good, merging!

👍

@Ocramius Ocramius merged commit f1bf045 into doctrine:master Nov 17, 2016
@kalimatas kalimatas deleted the fix-xml-option-boolean branch November 23, 2016 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants