Skip to content

Commit c6c5ab2

Browse files
TomasVotrubabbrala
andauthored
[PHPUnit60] Count expectUserDeprecationMessage() as assert in AddDoesNotPerformAssertionToNonAssertingTestRector (#825)
Co-authored-by: bjorn <bjorn@swis.nl>
1 parent 01783da commit c6c5ab2

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Rector\PHPUnit\Tests\PHPUnit60\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector\Fixture;
4+
5+
class SkipExpectUserDeprecationMessageTest extends \PHPUnit\Framework\TestCase
6+
{
7+
public function testExpectUserDeprecationMessage()
8+
{
9+
$this->expectUserDeprecationMessage('Since foo 1.0: Bar is deprecated.');
10+
11+
@trigger_error('Since foo 1.0: Bar is deprecated.', E_USER_DEPRECATED);
12+
}
13+
14+
public function testExpectUserDeprecationMessageMatches()
15+
{
16+
$this->expectUserDeprecationMessageMatches('#^Since foo 1\.0#');
17+
18+
@trigger_error('Since foo 1.0: Bar is deprecated.', E_USER_DEPRECATED);
19+
}
20+
}

‎src/NodeAnalyzer/AssertCallAnalyzer.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ final class AssertCallAnalyzer
3636
'expectException',
3737
'setExpectedException',
3838
'expectOutput',
39+
'expectUserDeprecationMessage',
3940
'should',
4041
];
4142

0 commit comments

Comments
 (0)