mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 05:18:18 +01:00
Updated Rector to commit ecc876ca19cb3ded0fa30ca856940b928b34b4b1
ecc876ca19
[build] add e2e tests (#12)
This commit is contained in:
parent
5f413efa75
commit
9fd49a8b07
50
.github/workflows/e2e.yaml
vendored
Normal file
50
.github/workflows/e2e.yaml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
name: End to End tests
|
||||
|
||||
on:
|
||||
pull_request: null
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
end_to_end:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ['7.4', '8.0']
|
||||
|
||||
name: PHP ${{ matrix.php }} system tests
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
coverage: none # disable xdebug, pcov
|
||||
|
||||
# This workflow runs system tests: Use the Rector application from the source
|
||||
# checkout to process "fixture" projects in tests/system-tests
|
||||
# to see if those can be processed successfully
|
||||
|
||||
- name: Generate Composer autoloaders in fixture directories
|
||||
run: |
|
||||
for FIXTURE in `find e2e -mindepth 1 -maxdepth 1 -type d`; do
|
||||
(cd $FIXTURE; composer install --no-progress --ansi)
|
||||
done
|
||||
|
||||
- name: Run system tests
|
||||
run: |
|
||||
HAS_FAILURES=0
|
||||
|
||||
for FIXTURE in `find e2e -mindepth 1 -maxdepth 1 -type d`; do
|
||||
echo "-----> Running $FIXTURE <-----"
|
||||
if (cd $FIXTURE; ../../bin/rector process --dry-run --clear-cache); then
|
||||
echo "-----> Result: OK <-----"
|
||||
else
|
||||
echo "-----> Result: FAILED <-----"
|
||||
HAS_FAILURES=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $HAS_FAILURES
|
7
e2e/dont-execute-code/composer.json
Normal file
7
e2e/dont-execute-code/composer.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Console\\Output\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
14
e2e/dont-execute-code/rector.php
Normal file
14
e2e/dont-execute-code/rector.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PATHS, [__DIR__.'/src']);
|
||||
|
||||
$containerConfigurator->import(SetList::PHP_53);
|
||||
};
|
9
e2e/dont-execute-code/src/OutputInterface.php
Normal file
9
e2e/dont-execute-code/src/OutputInterface.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
final class OutputInterface
|
||||
{
|
||||
|
||||
}
|
7
e2e/parse-php7-code/composer.json
Normal file
7
e2e/parse-php7-code/composer.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Foo\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
14
e2e/parse-php7-code/rector.php
Normal file
14
e2e/parse-php7-code/rector.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PATHS, [__DIR__.'/src']);
|
||||
|
||||
$containerConfigurator->import(SetList::PHP_53);
|
||||
};
|
12
e2e/parse-php7-code/src/Foo.php
Normal file
12
e2e/parse-php7-code/src/Foo.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Foo;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$bar = 'baz';
|
||||
print $bar{2};
|
||||
}
|
||||
}
|
7
e2e/parser-php8-code/composer.json
Normal file
7
e2e/parser-php8-code/composer.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Foo\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
14
e2e/parser-php8-code/rector.php
Normal file
14
e2e/parser-php8-code/rector.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PATHS, [__DIR__.'/src']);
|
||||
|
||||
$containerConfigurator->import(SetList::PHP_53);
|
||||
};
|
10
e2e/parser-php8-code/src/Foo.php
Normal file
10
e2e/parser-php8-code/src/Foo.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Foo;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __construct(
|
||||
public string $property = 'value',
|
||||
) {}
|
||||
}
|
@ -8,7 +8,6 @@ use Rector\ChangesReporting\ValueObjectFactory\ErrorFactory;
|
||||
use Rector\Core\Application\FileDecorator\FileDiffFileDecorator;
|
||||
use Rector\Core\Application\FileProcessor;
|
||||
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector;
|
||||
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesProcessor;
|
||||
use Rector\Core\Configuration\Configuration;
|
||||
use Rector\Core\Contract\Processor\FileProcessorInterface;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2::getLoader();
|
||||
return ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f::getLoader();
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2
|
||||
class ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0e9023fe060840085fb755bf5ce124b2::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit8e0c521d0267706f8265fce5c8f6726f::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit0e9023fe060840085fb755bf5ce124b2::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit8e0c521d0267706f8265fce5c8f6726f::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire0e9023fe060840085fb755bf5ce124b2($fileIdentifier, $file);
|
||||
composerRequire8e0c521d0267706f8265fce5c8f6726f($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire0e9023fe060840085fb755bf5ce124b2($fileIdentifier, $file)
|
||||
function composerRequire8e0c521d0267706f8265fce5c8f6726f($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit0e9023fe060840085fb755bf5ce124b2
|
||||
class ComposerStaticInit8e0c521d0267706f8265fce5c8f6726f
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
@ -3465,9 +3465,9 @@ class ComposerStaticInit0e9023fe060840085fb755bf5ce124b2
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0e9023fe060840085fb755bf5ce124b2::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0e9023fe060840085fb755bf5ce124b2::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0e9023fe060840085fb755bf5ce124b2::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit8e0c521d0267706f8265fce5c8f6726f::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit8e0c521d0267706f8265fce5c8f6726f::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit8e0c521d0267706f8265fce5c8f6726f::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
||||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210511\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2', false) && !interface_exists('ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2', false) && !trait_exists('ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2', false)) {
|
||||
spl_autoload_call('RectorPrefix20210511\ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2');
|
||||
if (!class_exists('ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f', false) && !interface_exists('ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f', false) && !trait_exists('ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f', false)) {
|
||||
spl_autoload_call('RectorPrefix20210511\ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210511\Doctrine\Inflector\Inflector');
|
||||
@ -92,9 +92,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20210511\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire0e9023fe060840085fb755bf5ce124b2')) {
|
||||
function composerRequire0e9023fe060840085fb755bf5ce124b2() {
|
||||
return \RectorPrefix20210511\composerRequire0e9023fe060840085fb755bf5ce124b2(...func_get_args());
|
||||
if (!function_exists('composerRequire8e0c521d0267706f8265fce5c8f6726f')) {
|
||||
function composerRequire8e0c521d0267706f8265fce5c8f6726f() {
|
||||
return \RectorPrefix20210511\composerRequire8e0c521d0267706f8265fce5c8f6726f(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user