22
33declare (strict_types=1 );
44
5- namespace Rector \PHPUnit \CodeQuality \Rector \MethodCall ;
5+ namespace Rector \PHPUnit \PHPUnit90 \Rector \MethodCall ;
66
77use PhpParser \Node ;
88use PhpParser \Node \Expr ;
2424use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
2525
2626/**
27- * @see \Rector\PHPUnit\Tests\CodeQuality \Rector\MethodCall\AssertRegExpRector\AssertRegExpRectorTest
27+ * @see \Rector\PHPUnit\Tests\PHPUnit90 \Rector\MethodCall\AssertRegExpRector\AssertRegExpRectorTest
2828 */
2929final class AssertRegExpRector extends AbstractRector
3030{
@@ -50,11 +50,11 @@ public function getRuleDefinition(): RuleDefinition
5050 [
5151 new CodeSample (
5252 '$this->assertSame(1, preg_match("/^Message for ".*"\.$/", $string), $message); ' ,
53- '$this->assertRegExp ("/^Message for ".*"\.$/", $string, $message); '
53+ '$this->assertMatchesRegularExpression ("/^Message for ".*"\.$/", $string, $message); '
5454 ),
5555 new CodeSample (
5656 '$this->assertEquals(false, preg_match("/^Message for ".*"\.$/", $string), $message); ' ,
57- '$this->assertNotRegExp ("/^Message for ".*"\.$/", $string, $message); '
57+ '$this->assertDoesNotMatchRegularExpression ("/^Message for ".*"\.$/", $string, $message); '
5858 ),
5959 ]
6060 );
@@ -163,13 +163,13 @@ private function renameMethod(MethodCall|StaticCall $node, string $oldMethodName
163163 if (in_array ($ oldMethodName , [self ::ASSERT_SAME , self ::ASSERT_EQUALS ], true ) && $ oldCondition === 1
164164 || in_array ($ oldMethodName , [self ::ASSERT_NOT_SAME , self ::ASSERT_NOT_EQUALS ], true ) && $ oldCondition === 0
165165 ) {
166- $ node ->name = new Identifier ('assertRegExp ' );
166+ $ node ->name = new Identifier ('assertMatchesRegularExpression ' );
167167 }
168168
169169 if (in_array ($ oldMethodName , [self ::ASSERT_SAME , self ::ASSERT_EQUALS ], true ) && $ oldCondition === 0
170170 || in_array ($ oldMethodName , [self ::ASSERT_NOT_SAME , self ::ASSERT_NOT_EQUALS ], true ) && $ oldCondition === 1
171171 ) {
172- $ node ->name = new Identifier ('assertNotRegExp ' );
172+ $ node ->name = new Identifier ('assertDoesNotMatchRegularExpression ' );
173173 }
174174 }
175175
0 commit comments