diff --git a/README.md b/README.md index d21f7568..799b02a1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ use Rector\PHPUnit\Set\PHPUnitSetList; return RectorConfig::configure() ->withSets([ - PHPUnitSetList::PHPUNIT_90, + PHPUnitSetList::COMPOSER_BASED, ]); ``` diff --git a/config/sets/phpunit100.php b/config/sets/phpunit100.php deleted file mode 100644 index d456d305..00000000 --- a/config/sets/phpunit100.php +++ /dev/null @@ -1,105 +0,0 @@ -sets([PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES]); - - $rectorConfig->rules([ - StaticDataProviderClassMethodRector::class, - PublicDataProviderClassMethodRector::class, - AddProphecyTraitRector::class, - WithConsecutiveRector::class, - RemoveSetMethodsMethodCallRector::class, - PropertyExistsWithoutAssertRector::class, - ParentTestClassConstructorRector::class, - ]); - - $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [ - // https://github.com/sebastianbergmann/phpunit/issues/4087 - new MethodCallRename('PHPUnit\Framework\Assert', 'assertRegExp', 'assertMatchesRegularExpression'), - - // https://github.com/sebastianbergmann/phpunit/issues/5220 - new MethodCallRename('PHPUnit\Framework\Assert', 'assertObjectHasAttribute', 'assertObjectHasProperty'), - new MethodCallRename('PHPUnit\Framework\Assert', 'assertObjectNotHasAttribute', 'assertObjectNotHasProperty'), - - new MethodCallRename( - 'PHPUnit\Framework\MockObject\Rule\InvocationOrder', - 'getInvocationCount', - 'numberOfInvocations' - ), - - // https://github.com/sebastianbergmann/phpunit/issues/4090 - new MethodCallRename('PHPUnit\Framework\Assert', 'assertNotRegExp', 'assertDoesNotMatchRegularExpression'), - - // https://github.com/sebastianbergmann/phpunit/issues/4078 - new MethodCallRename('PHPUnit\Framework\Assert', 'assertFileNotExists', 'assertFileDoesNotExist'), - - // https://github.com/sebastianbergmann/phpunit/issues/4081 - new MethodCallRename('PHPUnit\Framework\Assert', 'assertFileNotIsReadable', 'assertFileIsNotReadable'), - - // https://github.com/sebastianbergmann/phpunit/issues/4072 - new MethodCallRename( - 'PHPUnit\Framework\Assert', - 'assertDirectoryNotIsReadable', - 'assertDirectoryIsNotReadable' - ), - - // https://github.com/sebastianbergmann/phpunit/issues/4075 - new MethodCallRename( - 'PHPUnit\Framework\Assert', - 'assertDirectoryNotIsWritable', - 'assertDirectoryIsNotWritable' - ), - - // https://github.com/sebastianbergmann/phpunit/issues/4069 - new MethodCallRename('PHPUnit\Framework\Assert', 'assertDirectoryNotExists', 'assertDirectoryDoesNotExist'), - - // https://github.com/sebastianbergmann/phpunit/issues/4066 - new MethodCallRename('PHPUnit\Framework\Assert', 'assertNotIsWritable', 'assertIsNotWritable'), - - // https://github.com/sebastianbergmann/phpunit/issues/4063 - new MethodCallRename('PHPUnit\Framework\Assert', 'assertNotIsReadable', 'assertIsNotReadable'), - - // https://github.com/sebastianbergmann/phpunit/pull/3687 - new MethodCallRename('PHPUnit\Framework\MockObject\MockBuilder', 'setMethods', 'onlyMethods'), - - // https://github.com/sebastianbergmann/phpunit/issues/5062 - new MethodCallRename('PHPUnit\Framework\TestCase', 'expectDeprecationMessage', 'expectExceptionMessage'), - new MethodCallRename( - 'PHPUnit\Framework\TestCase', - 'expectDeprecationMessageMatches', - 'expectExceptionMessageMatches' - ), - new MethodCallRename('PHPUnit\Framework\TestCase', 'expectNoticeMessage', 'expectExceptionMessage'), - new MethodCallRename( - 'PHPUnit\Framework\TestCase', - 'expectNoticeMessageMatches', - 'expectExceptionMessageMatches' - ), - new MethodCallRename('PHPUnit\Framework\TestCase', 'expectWarningMessage', 'expectExceptionMessage'), - new MethodCallRename( - 'PHPUnit\Framework\TestCase', - 'expectWarningMessageMatches', - 'expectExceptionMessageMatches' - ), - new MethodCallRename('PHPUnit\Framework\TestCase', 'expectErrorMessage', 'expectExceptionMessage'), - new MethodCallRename( - 'PHPUnit\Framework\TestCase', - 'expectErrorMessageMatches', - 'expectExceptionMessageMatches' - ), - ]); -}; diff --git a/config/sets/phpunit110.php b/config/sets/phpunit110.php deleted file mode 100644 index 9306f4d3..00000000 --- a/config/sets/phpunit110.php +++ /dev/null @@ -1,15 +0,0 @@ -sets([PHPUnitSetList::COMPOSER_BASED]); - - $rectorConfig->rules([NamedArgumentForDataProviderRector::class]); -}; diff --git a/config/sets/phpunit120.php b/config/sets/phpunit120.php deleted file mode 100644 index 520e38c6..00000000 --- a/config/sets/phpunit120.php +++ /dev/null @@ -1,13 +0,0 @@ -sets([PHPUnitSetList::PHPUNIT_MOCK_TO_STUB, PHPUnitSetList::COMPOSER_BASED]); - - $rectorConfig->rules([RemoveOverrideFinalConstructTestCaseRector::class]); -}; diff --git a/config/sets/phpunit125.php b/config/sets/phpunit125.php deleted file mode 100644 index 6adf9123..00000000 --- a/config/sets/phpunit125.php +++ /dev/null @@ -1,19 +0,0 @@ -rules([ - AllowMockObjectsWhereParentClassRector::class, - AllowMockObjectsForDataProviderRector::class, - - // experimental, from PHPUnit 12.5.2 - // @see https://github.com/sebastianbergmann/phpunit/commit/24c208d6a340c3071f28a9b5cce02b9377adfd43 - AllowMockObjectsWithoutExpectationsAttributeRector::class, - ]); -}; diff --git a/config/sets/phpunit130.php b/config/sets/phpunit130.php deleted file mode 100644 index 47e20d16..00000000 --- a/config/sets/phpunit130.php +++ /dev/null @@ -1,19 +0,0 @@ -sets([PHPUnitSetList::COMPOSER_BASED]); - - $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [ - // @see https://github.com/sebastianbergmann/phpunit/issues/6560 - new MethodCallRename('PHPUnit\Framework\TestCase', 'expectExceptionMessage', 'expectExceptionMessageIsOrContains'), - ]); -}; diff --git a/config/sets/phpunit40.php b/config/sets/phpunit40.php deleted file mode 100644 index a820392c..00000000 --- a/config/sets/phpunit40.php +++ /dev/null @@ -1,18 +0,0 @@ -ruleWithConfiguration(RenameMethodRector::class, [ - new MethodCallRename( - 'PHPUnit_Framework_MockObject_MockObject', - # see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/137 - 'staticExpects', - 'expects' - ), - ]); -}; diff --git a/config/sets/phpunit50.php b/config/sets/phpunit50.php deleted file mode 100644 index 1fbf9f3f..00000000 --- a/config/sets/phpunit50.php +++ /dev/null @@ -1,10 +0,0 @@ -rule(GetMockRector::class); -}; diff --git a/config/sets/phpunit60.php b/config/sets/phpunit60.php deleted file mode 100644 index 27f00700..00000000 --- a/config/sets/phpunit60.php +++ /dev/null @@ -1,158 +0,0 @@ -rules([ - DelegateExceptionArgumentsRector::class, - ExceptionAnnotationRector::class, - AddDoesNotPerformAssertionToNonAssertingTestRector::class, - GetMockBuilderGetMockToCreateMockRector::class, - ]); - - $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [ - new MethodCallRename('PHPUnit\Framework\TestClass', 'setExpectedException', 'expectedException'), - new MethodCallRename('PHPUnit\Framework\TestClass', 'setExpectedExceptionRegExp', 'expectedException'), - new MethodCallRename('PHPUnit\Framework\TestCase', 'createMockBuilder', 'getMockBuilder'), - ]); - - $rectorConfig->ruleWithConfiguration(RenameClassRector::class, [ - // ref. https://github.com/sebastianbergmann/phpunit/compare/5.7.9...6.0.0 - 'PHPUnit_Framework_MockObject_Stub' => 'PHPUnit\Framework\MockObject\Stub', - 'PHPUnit_Framework_MockObject_Stub_Return' => 'PHPUnit\Framework\MockObject\Stub\ReturnStub', - 'PHPUnit_Framework_MockObject_Matcher_Parameters' => 'PHPUnit\Framework\MockObject\Matcher\Parameters', - 'PHPUnit_Framework_MockObject_Matcher_Invocation' => 'PHPUnit\Framework\MockObject\Matcher\Invocation', - 'PHPUnit_Framework_MockObject_MockObject' => 'PHPUnit\Framework\MockObject\MockObject', - 'PHPUnit_Framework_MockObject_Invocation_Object' => 'PHPUnit\Framework\MockObject\Invocation\ObjectInvocation', - 'PHPUnit_Framework_Assert' => 'PHPUnit\Framework\Assert', - 'PHPUnit_Framework_AssertionFailedError' => 'PHPUnit\Framework\AssertionFailedError', - 'PHPUnit_Framework_BaseTestListener' => 'PHPUnit\Framework\BaseTestListener', - 'PHPUnit_Framework_CodeCoverageException' => 'PHPUnit\Framework\CodeCoverageException', - 'PHPUnit_Exception' => 'PHPUnit\Exception', - 'PHPUnit_Framework_Exception' => 'PHPUnit\Framework\Exception', - 'PHPUnit_Framework_ExceptionWrapper' => 'PHPUnit\Framework\ExceptionWrapper', - 'PHPUnit_Framework_ExpectationFailedException' => 'PHPUnit\Framework\ExpectationFailedException', - 'PHPUnit_Framework_IncompleteTest' => 'PHPUnit\Framework\IncompleteTest', - 'PHPUnit_Framework_IncompleteTestCase' => 'PHPUnit\Framework\IncompleteTestCase', - 'PHPUnit_Framework_IncompleteTestError' => 'PHPUnit\Framework\IncompleteTestError', - 'PHPUnit_Framework_InvalidCoversTargetException' => 'PHPUnit\Framework\InvalidCoversTargetException', - 'PHPUnit_Framework_OutputError' => 'PHPUnit\Framework\OutputError', - 'PHPUnit_Framework_CoveredCodeNotExecutedException' => 'PHPUnit\Framework\CoveredCodeNotExecutedException', - 'PHPUnit_Framework_MissingCoversAnnotationException' => 'PHPUnit\Framework\MissingCoversAnnotationException', - 'PHPUnit_Framework_RiskyTest' => 'PHPUnit\Framework\RiskyTest', - 'PHPUnit_Framework_RiskyTestError' => 'PHPUnit\Framework\RiskyTestError', - 'PHPUnit_Framework_SkippedTest' => 'PHPUnit\Framework\SkippedTest', - 'PHPUnit_Framework_SkippedTestCase' => 'PHPUnit\Framework\SkippedTestCase', - 'PHPUnit_Framework_SkippedTestError' => 'PHPUnit\Framework\SkippedTestError', - 'PHPUnit_Framework_SkippedTestSuiteError' => 'PHPUnit\Framework\SkippedTestSuiteError', - 'PHPUnit_Framework_SyntheticError' => 'PHPUnit\Framework\SyntheticError', - 'PHPUnit_Framework_Test' => 'PHPUnit\Framework\Test', - 'PHPUnit_Framework_TestCase' => 'PHPUnit\Framework\TestCase', - 'PHPUnit_Framework_TestFailure' => 'PHPUnit\Framework\TestFailure', - 'PHPUnit_Framework_TestListener' => 'PHPUnit\Framework\TestListener', - 'PHPUnit_Framework_TestResult' => 'PHPUnit\Framework\TestResult', - 'PHPUnit_Framework_TestSuite' => 'PHPUnit\Framework\TestSuite', - 'PHPUnit_Framework_UnintentionallyCoveredCodeError' => 'PHPUnit\Framework\UnintentionallyCoveredCodeError', - 'PHPUnit_Framework_Warning' => 'PHPUnit\Framework\Warning', - 'PHPUnit_Framework_WarningTestCase' => 'PHPUnit\Framework\WarningTestCase', - 'PHPUnit_Framework_Constraint_And' => 'PHPUnit\Framework\Constraint\LogicalAnd', - 'PHPUnit_Framework_Constraint_ArrayHasKey' => 'PHPUnit\Framework\Constraint\ArrayHasKey', - 'PHPUnit_Framework_Constraint_ArraySubset' => 'PHPUnit\Framework\Constraint\ArraySubset', - 'PHPUnit_Framework_Constraint_Attribute' => 'PHPUnit\Framework\Constraint\Attribute', - 'PHPUnit_Framework_Constraint_Callback' => 'PHPUnit\Framework\Constraint\Callback', - 'PHPUnit_Framework_Constraint_ClassHasAttribute' => 'PHPUnit\Framework\Constraint\ClassHasAttribute', - 'PHPUnit_Framework_Constraint_Composite' => 'PHPUnit\Framework\Constraint\Composite', - 'PHPUnit_Framework_Constraint_Count' => 'PHPUnit\Framework\Constraint\Count', - 'PHPUnit_Framework_Constraint_DirectoryExists' => 'PHPUnit\Framework\Constraint\DirectoryExists', - 'PHPUnit_Framework_Constraint' => 'PHPUnit\Framework\Constraint\Constraint', - 'PHPUnit_Framework_Constraint_Exception' => 'PHPUnit\Framework\Constraint\Exception', - 'PHPUnit_Framework_Constraint_ExceptionCode' => 'PHPUnit\Framework\Constraint\ExceptionCode', - 'PHPUnit_Framework_Constraint_ExceptionMessage' => 'PHPUnit\Framework\Constraint\ExceptionMessage', - 'PHPUnit_Framework_Constraint_ExceptionMessageRegExp' => 'PHPUnit_Framework_Constraint_ExceptionMessageRegularExpression', - 'PHPUnit_Framework_Constraint_FileExists' => 'PHPUnit\Framework\Constraint\FileExists', - 'PHPUnit_Framework_Constraint_GreaterThan' => 'PHPUnit\Framework\Constraint\GreaterThan', - 'PHPUnit_Framework_Constraint_IsAnything' => 'PHPUnit\Framework\Constraint\IsAnything', - 'PHPUnit_Framework_Constraint_IsEmpty' => 'PHPUnit\Framework\Constraint\IsEmpty', - 'PHPUnit_Framework_Constraint_IsIdentical' => 'PHPUnit\Framework\Constraint\IsIdentical', - 'PHPUnit_Framework_Constraint_IsInfinite' => 'PHPUnit\Framework\Constraint\IsInfinite', - 'PHPUnit_Framework_Constraint_IsInstanceOf' => 'PHPUnit\Framework\Constraint\IsInstanceOf', - 'PHPUnit_Framework_Constraint_IsJson' => 'PHPUnit\Framework\Constraint\IsJson', - 'PHPUnit_Framework_Constraint_IsNan' => 'PHPUnit\Framework\Constraint\IsNan', - 'PHPUnit_Framework_Constraint_IsNull' => 'PHPUnit\Framework\Constraint\IsNull', - 'PHPUnit_Framework_Constraint_IsReadable' => 'PHPUnit\Framework\Constraint\IsReadable', - 'PHPUnit_Framework_Constraint_IsTrue' => 'PHPUnit\Framework\Constraint\IsTrue', - 'PHPUnit_Framework_Constraint_IsType' => 'PHPUnit\Framework\Constraint\IsType', - 'PHPUnit_Framework_Constraint_IsWritable' => 'PHPUnit\Framework\Constraint\IsWritable', - 'PHPUnit_Framework_Constraint_JsonMatches' => 'PHPUnit\Framework\Constraint\JsonMatches', - 'PHPUnit_Framework_Constraint_LessThan' => 'PHPUnit\Framework\Constraint\LessThan', - 'PHPUnit_Framework_Constraint_Not' => 'PHPUnit\Framework\Constraint\LogicalNot', - 'PHPUnit_Framework_Constraint_ObjectHasAttribute' => 'PHPUnit\Framework\Constraint\ObjectHasAttribute', - 'PHPUnit_Framework_Constraint_Or' => 'PHPUnit\Framework\Constraint\LogicalOr', - 'PHPUnit_Framework_Constraint_PCREMatch' => 'PHPUnit\Framework\Constraint\RegularExpression', - 'PHPUnit_Framework_Constraint_SameSize' => 'PHPUnit\Framework\Constraint\SameSize', - 'PHPUnit_Framework_Constraint_StringContains' => 'PHPUnit\Framework\Constraint\StringContains', - 'PHPUnit_Framework_Constraint_StringEndsWith' => 'PHPUnit\Framework\Constraint\StringEndsWith', - 'PHPUnit_Framework_Constraint_StringMatches' => 'PHPUnit\Framework\Constraint\StringMatchesFormatDescription', - 'PHPUnit_Framework_Constraint_StringStartsWith' => 'PHPUnit\Framework\Constraint\StringStartsWith', - 'PHPUnit_Framework_Constraint_TraversableContains' => 'PHPUnit\Framework\Constraint\TraversableContains', - 'PHPUnit_Framework_Constraint_TraversableContainsOnly' => 'PHPUnit\Framework\Constraint\TraversableContainsOnly', - 'PHPUnit_Framework_Constraint_Xor' => 'PHPUnit\Framework\Constraint\LogicalXor', - 'PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider' => 'PHPUnit\Framework\Constraint\JsonMatchesErrorMessageProvider', - 'PHPUnit_Framework_Error_Deprecated' => 'PHPUnit\Framework\Error\Deprecated', - 'PHPUnit_Framework_Error_Notice' => 'PHPUnit\Framework\Error\Notice', - 'PHPUnit_Framework_Error_Warning' => 'PHPUnit\Framework\Error\Warning', - 'PHPUnit_Framework_TestSuite_DataProvider' => 'PHPUnit\Framework\DataProviderTestSuite', - 'PHPUnit_Framework_Error' => 'PHPUnit\Framework\Error\Error', - 'PHPUnit_Runner_BaseTestRunner' => 'PHPUnit\Runner\BaseTestRunner', - 'PHPUnit_Runner_Exception' => 'PHPUnit\Runner\Exception', - 'PHPUnit_Runner_PhptTestCase' => 'PHPUnit\Runner\PhptTestCase', - 'PHPUnit_Runner_StandardTestSuiteLoader' => 'PHPUnit\Runner\StandardTestSuiteLoader', - 'PHPUnit_Runner_TestSuiteLoader' => 'PHPUnit\Runner\TestSuiteLoader', - 'PHPUnit_Runner_Version' => 'PHPUnit\Runner\Version', - 'PHPUnit_Runner_Filter_Factory' => 'PHPUnit\Runner\Filter\Factory', - 'PHPUnit_Runner_Filter_GroupFilterIterator' => 'PHPUnit\Runner\Filter\GroupFilterIterator', - 'PHPUnit_Runner_Filter_Test' => 'PHPUnit\Runner\Filter\NameFilterIterator', - 'PHPUnit_Runner_Filter_Group_Exclude' => 'PHPUnit\Runner\Filter\ExcludeGroupFilterIterator', - 'PHPUnit_Runner_Filter_Group_Include' => 'PHPUnit\Runner\Filter\IncludeGroupFilterIterator', - 'PHPUnit_TextUI_Command' => 'PHPUnit\TextUI\Command', - 'PHPUnit_TextUI_ResultPrinter' => 'PHPUnit\TextUI\ResultPrinter', - 'PHPUnit_TextUI_TestRunner' => 'PHPUnit\TextUI\TestRunner', - 'PHPUnit_Util_Blacklist' => 'PHPUnit\Util\Blacklist', - 'PHPUnit_Util_Configuration' => 'PHPUnit\Util\Configuration', - 'PHPUnit_Util_ConfigurationGenerator' => 'PHPUnit\Util\ConfigurationGenerator', - 'PHPUnit_Util_ErrorHandler' => 'PHPUnit\Util\ErrorHandler', - 'PHPUnit_Util_Fileloader' => 'PHPUnit\Util\Fileloader', - 'PHPUnit_Util_Filesystem' => 'PHPUnit\Util\Filesystem', - 'PHPUnit_Util_Filter' => 'PHPUnit\Util\Filter', - 'PHPUnit_Util_Getopt' => 'PHPUnit\Util\Getopt', - 'PHPUnit_Util_GlobalState' => 'PHPUnit\Util\GlobalState', - 'PHPUnit_Util_InvalidArgumentHelper' => 'PHPUnit\Util\InvalidArgumentHelper', - 'PHPUnit_Util_PHP' => 'PHPUnit\Util\PHP\AbstractPhpProcess', - 'PHPUnit_Util_PHP_Default' => 'PHPUnit\Util\PHP\DefaultPhpProcess', - 'PHPUnit_Util_PHP_Windows' => 'PHPUnit\Util\PHP\WindowsPhpProcesPhpProcess', - 'PHPUnit_Util_Log_JUnit' => 'PHPUnit\Util\Log\JUnit', - 'PHPUnit_Util_Log_TeamCity' => 'PHPUnit\Util\Log\TeamCity', - 'PHPUnit_Util_TestDox_NamePrettifier' => 'PHPUnit\Util\TestDox\NamePrettifier', - 'PHPUnit_Util_TestDox_ResultPrinter' => 'PHPUnit\Util\TestDox\ResultPrinter', - 'PHPUnit_Util_TestDox_ResultPrinter_HTML' => 'PHPUnit\Util\TestDox\HtmlResultPrinter', - 'PHPUnit_Util_TestDox_ResultPrinter_Text' => 'PHPUnit\Util\TestDox\TextResultPrinter', - 'PHPUnit_Util_TestDox_ResultPrinter_XML' => 'PHPUnit\Util\TestDox\XmlResultPrinter', - 'PHPUnit_Util_Printer' => 'PHPUnit\Util\Printer', - 'PHPUnit_Util_Regex' => 'PHPUnit\Util\RegularExpression', - 'PHPUnit_Util_String' => 'PHPUnit\Util\Utf8', - 'PHPUnit_Util_XML' => 'PHPUnit\Util\XML', - 'PHPUnit_Util_TestSuiteIterator' => 'PHPUnit\Framework\TestSuiteIterator', - 'PHPUnit_Util_Type' => 'PHPUnit\Util\Type', - 'PHPUnit_Util_Test' => 'PHPUnit\Util\Test', - ]); -}; diff --git a/config/sets/phpunit70.php b/config/sets/phpunit70.php deleted file mode 100644 index cc00af1b..00000000 --- a/config/sets/phpunit70.php +++ /dev/null @@ -1,16 +0,0 @@ -ruleWithConfiguration(RenameAnnotationRector::class, [ - new RenameAnnotationByType('PHPUnit\Framework\TestCase', 'scenario', 'test'), - ]); - - $rectorConfig->rule(RemoveDataProviderTestPrefixRector::class); -}; diff --git a/config/sets/phpunit80.php b/config/sets/phpunit80.php deleted file mode 100644 index 2e1c6b0a..00000000 --- a/config/sets/phpunit80.php +++ /dev/null @@ -1,44 +0,0 @@ -rules([ - SpecificAssertInternalTypeRector::class, - AssertEqualsParameterToSpecificMethodsTypeRector::class, - SpecificAssertContainsRector::class, - ]); - - $rectorConfig->ruleWithConfiguration(RenameClassRector::class, [ - # https://github.com/sebastianbergmann/phpunit/issues/3123 - 'PHPUnit_Framework_MockObject_MockObject' => 'PHPUnit\Framework\MockObject\MockObject', - ]); - - $rectorConfig->ruleWithConfiguration(AddParamTypeDeclarationRector::class, [ - // https://github.com/rectorphp/rector/issues/1024 - no type, $dataName - new AddParamTypeDeclaration('PHPUnit\Framework\TestCase', MethodName::CONSTRUCT, 2, new MixedType()), - ]); - - $rectorConfig->ruleWithConfiguration(AddReturnTypeDeclarationRector::class, [ - new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'setUpBeforeClass', new VoidType()), - new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'setUp', new VoidType()), - new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'assertPreConditions', new VoidType()), - new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'assertPostConditions', new VoidType()), - new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'tearDown', new VoidType()), - new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'tearDownAfterClass', new VoidType()), - new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'onNotSuccessfulTest', new VoidType()), - ]); -}; diff --git a/config/sets/phpunit90.php b/config/sets/phpunit90.php deleted file mode 100644 index 5cbaf8ff..00000000 --- a/config/sets/phpunit90.php +++ /dev/null @@ -1,41 +0,0 @@ -rules([ - TestListenerToHooksRector::class, - ExplicitPhpErrorApiRector::class, - SpecificAssertContainsWithoutIdentityRector::class, - WithConsecutiveRector::class, - AssertRegExpRector::class, - ]); - - $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [ - // see https://github.com/sebastianbergmann/phpunit/issues/3957 - new MethodCallRename( - 'PHPUnit\Framework\TestCase', - 'expectExceptionMessageRegExp', - 'expectExceptionMessageMatches' - ), - - // @see https://github.com/sebastianbergmann/phpunit/issues/4086 - new MethodCallRename('PHPUnit\Framework\TestCase', 'assertRegExp', 'assertMatchesRegularExpression'), - - // @see https://github.com/sebastianbergmann/phpunit/issues/4089 - new MethodCallRename( - 'PHPUnit\Framework\TestCase', - 'assertNotRegExp', - 'assertDoesNotMatchRegularExpression' - ), - ]); -}; diff --git a/src/Set/PHPUnitSetList.php b/src/Set/PHPUnitSetList.php index f24a9952..2aedf991 100644 --- a/src/Set/PHPUnitSetList.php +++ b/src/Set/PHPUnitSetList.php @@ -9,26 +9,6 @@ */ final class PHPUnitSetList { - public const string PHPUNIT_40 = __DIR__ . '/../../config/sets/phpunit40.php'; - - public const string PHPUNIT_50 = __DIR__ . '/../../config/sets/phpunit50.php'; - - public const string PHPUNIT_60 = __DIR__ . '/../../config/sets/phpunit60.php'; - - public const string PHPUNIT_70 = __DIR__ . '/../../config/sets/phpunit70.php'; - - public const string PHPUNIT_80 = __DIR__ . '/../../config/sets/phpunit80.php'; - - public const string PHPUNIT_90 = __DIR__ . '/../../config/sets/phpunit90.php'; - - public const string PHPUNIT_100 = __DIR__ . '/../../config/sets/phpunit100.php'; - - public const string PHPUNIT_110 = __DIR__ . '/../../config/sets/phpunit110.php'; - - public const string PHPUNIT_120 = __DIR__ . '/../../config/sets/phpunit120.php'; - - public const string PHPUNIT_130 = __DIR__ . '/../../config/sets/phpunit130.php'; - public const string PHPUNIT_MOCK_TO_STUB = __DIR__ . '/../../config/sets/phpunit-mock-to-stub.php'; public const string PHPUNIT_CODE_QUALITY = __DIR__ . '/../../config/sets/phpunit-code-quality.php'; diff --git a/tests/Issues/PHPUnit10DataProvider/Fixture/some_test.php.inc b/tests/Issues/PHPUnit10DataProvider/Fixture/some_test.php.inc index adf5e0dd..8d2b47cd 100644 --- a/tests/Issues/PHPUnit10DataProvider/Fixture/some_test.php.inc +++ b/tests/Issues/PHPUnit10DataProvider/Fixture/some_test.php.inc @@ -28,6 +28,7 @@ final class SomeTest extends \PHPUnit\Framework\TestCase { #[\PHPUnit\Framework\Attributes\DataProvider('fooProvider')] #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function it_should_do_stuff(string $foo): void { } diff --git a/tests/Issues/PHPUnit10DataProvider/config/configured_rule.php b/tests/Issues/PHPUnit10DataProvider/config/configured_rule.php index 9c360db6..5522a760 100644 --- a/tests/Issues/PHPUnit10DataProvider/config/configured_rule.php +++ b/tests/Issues/PHPUnit10DataProvider/config/configured_rule.php @@ -6,5 +6,5 @@ use Rector\PHPUnit\Set\PHPUnitSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([PHPUnitSetList::PHPUNIT_100]); + $rectorConfig->sets([PHPUnitSetList::COMPOSER_BASED]); };