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
setIgnoreNotImportedAnnotations(true)
doesn't work on already autoloaded classes
#110
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -387,8 +387,11 @@ public function testInvalidAnnotationUsageButIgnoredClass() | |
$reader = $this->getReader(); | ||
$ref = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\InvalidAnnotationUsageButIgnoredClass'); | ||
$annots = $reader->getClassAnnotations($ref); | ||
|
||
$this->assertEquals(2, count($annots)); | ||
if ($annots[0] instanceof IgnoreAnnotation) { | ||
$this->assertEquals(2, count($annots)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use assertCount everywhere you count in the assertion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You realise that this justification is weak right ? The reason to use assertCount here is because it will make the error message when the test fails an order of magnitude easier to understand and that why we test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm in favour of Please create a pull request changing all the assertEquals into the better assertCount and when that gets merged first i'll gladly change the assertions. PS. In my personal project I use |
||
} else { // SimpleAnnotationReader doens't include the IgnoreAnnotation in the results. | ||
$this->assertEquals(1, count($annots)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assertCount |
||
} | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1049,6 +1049,15 @@ public function testNotAnAnnotationClassIsIgnoredWithoutWarning() | |
$this->assertEquals(0, count($result)); | ||
} | ||
|
||
public function testNotAnAnnotationClassIsIgnoredWithoutWarningWithoutCheating() | ||
{ | ||
$parser = new DocParser(); | ||
$parser->setIgnoreNotImportedAnnotations(true); | ||
$result = $parser->parse('@PHPUnit_Framework_TestCase'); | ||
|
||
$this->assertEquals(0, count($result)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assertCount |
||
} | ||
|
||
/** | ||
* @expectedException \Doctrine\Common\Annotations\AnnotationException | ||
* @expectedExceptionMessage Expected PlainValue, got ''' at position 10. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you split that test is 2 distinct ones.
The "if" here indicate that you are testing 2 different behaviours in the same test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed if statement from the unittest and moved testing the behaviour of SimpleAnnotationReader into the SimpleAnnotationReaderTest