forked from rectorphp/rector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpspec-to-phpunit.php
34 lines (24 loc) · 1.35 KB
/
phpspec-to-phpunit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare(strict_types=1);
use Rector\PhpSpecToPHPUnit\Rector\Class_\AddMockPropertiesRector;
use Rector\PhpSpecToPHPUnit\Rector\Class_\PhpSpecClassToPHPUnitClassRector;
use Rector\PhpSpecToPHPUnit\Rector\ClassMethod\PhpSpecMethodToPHPUnitMethodRector;
use Rector\PhpSpecToPHPUnit\Rector\FileNode\RenameSpecFileToTestFileRector;
use Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecMocksToPHPUnitMocksRector;
use Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecPromisesToPHPUnitAssertRector;
use Rector\PhpSpecToPHPUnit\Rector\Variable\MockVariableToPropertyFetchRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
# see: https://gnugat.github.io/2015/09/23/phpunit-with-phpspec.html
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# 1. first convert mocks
$services->set(PhpSpecMocksToPHPUnitMocksRector::class);
$services->set(PhpSpecPromisesToPHPUnitAssertRector::class);
# 2. then methods
$services->set(PhpSpecMethodToPHPUnitMethodRector::class);
# 3. then the class itself
$services->set(PhpSpecClassToPHPUnitClassRector::class);
$services->set(AddMockPropertiesRector::class);
$services->set(MockVariableToPropertyFetchRector::class);
$services->set(RenameSpecFileToTestFileRector::class);
};