mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
[AddDoesNotPerformAssertionToNonAssertingTestRector] fix skippi… (#2636)
[AddDoesNotPerformAssertionToNonAssertingTestRector] fix skipping if annotation already exists (fixes infinite loop too)
This commit is contained in:
commit
9cac83e364
@ -131,7 +131,7 @@ PHP
|
||||
|
||||
if ($classMethod->getDocComment() !== null) {
|
||||
$text = $classMethod->getDocComment();
|
||||
if (Strings::match($text->getText(), '#@expectedException\b#')) {
|
||||
if (Strings::match($text->getText(), '#@(doesNotPerformAssertion|expectedException\b)#')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\PHPUnit\Tests\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector\Fixture;
|
||||
|
||||
class SkipExistingAnnotation extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @doesNotPerformAssertion
|
||||
*/
|
||||
public function testSomething(): void
|
||||
{
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user