2020-07-18 18:57:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-08-18 17:57:30 +02:00
|
|
|
use Rector\Generic\Rector\Name\PseudoNamespaceToNamespaceRector;
|
2020-08-26 12:54:53 +02:00
|
|
|
|
2020-09-12 23:19:08 +02:00
|
|
|
use Rector\Generic\ValueObject\PseudoNamespaceToNamespace;
|
2020-07-18 18:57:24 +02:00
|
|
|
use Rector\PHPUnit\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector;
|
|
|
|
use Rector\PHPUnit\Rector\MethodCall\GetMockBuilderGetMockToCreateMockRector;
|
|
|
|
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
2020-08-18 17:57:30 +02:00
|
|
|
use Rector\Renaming\Rector\Name\RenameClassRector;
|
2020-08-25 00:26:14 +02:00
|
|
|
use Rector\Renaming\ValueObject\MethodCallRename;
|
|
|
|
use function Rector\SymfonyPhpConfig\inline_value_objects;
|
2020-07-18 18:57:24 +02:00
|
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
|
|
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
|
|
$containerConfigurator->import(__DIR__ . '/phpunit-exception.php');
|
|
|
|
|
|
|
|
$services = $containerConfigurator->services();
|
|
|
|
|
|
|
|
$services->set(RenameMethodRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-08-25 00:37:12 +02:00
|
|
|
RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([
|
2020-08-25 00:26:14 +02:00
|
|
|
new MethodCallRename('PHPUnit\Framework\TestCase', 'createMockBuilder', 'getMockBuilder'),
|
|
|
|
]),
|
2020-07-30 00:43:06 +02:00
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
$services->set(RenameClassRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-07-30 01:39:41 +02:00
|
|
|
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
2020-07-30 00:43:06 +02:00
|
|
|
'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',
|
|
|
|
],
|
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
$services->set(PseudoNamespaceToNamespaceRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-08-26 12:54:53 +02:00
|
|
|
// ref. https://github.com/sebastianbergmann/phpunit/compare/5.7.9...6.0.0
|
|
|
|
PseudoNamespaceToNamespaceRector::NAMESPACE_PREFIXES_WITH_EXCLUDED_CLASSES => inline_value_objects(
|
2020-09-12 23:19:08 +02:00
|
|
|
[new PseudoNamespaceToNamespace('PHPUnit_', [
|
2020-07-30 00:43:06 +02:00
|
|
|
'PHPUnit_Framework_MockObject_MockObject',
|
|
|
|
'PHPUnit_Framework_MockObject_Invocation_Object',
|
|
|
|
'PHPUnit_Framework_MockObject_Matcher_Invocation',
|
|
|
|
'PHPUnit_Framework_MockObject_Matcher_Parameters',
|
|
|
|
'PHPUnit_Framework_MockObject_Stub_Return',
|
|
|
|
'PHPUnit_Framework_MockObject_Stub',
|
2020-08-26 12:54:53 +02:00
|
|
|
])]
|
|
|
|
),
|
2020-07-30 00:43:06 +02:00
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
$services->set(AddDoesNotPerformAssertionToNonAssertingTestRector::class);
|
|
|
|
|
|
|
|
$services->set(GetMockBuilderGetMockToCreateMockRector::class);
|
|
|
|
};
|