Skip to content

Commit

Permalink
Updated Rector to commit ecc876c
Browse files Browse the repository at this point in the history
rectorphp@ecc876c [build] add e2e tests (rectorphp#12)
  • Loading branch information
TomasVotruba committed May 11, 2021
1 parent 5f413ef commit 9fd49a8
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 18 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions e2e/dont-execute-code/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\Output\\": "src"
}
}
}
14 changes: 14 additions & 0 deletions e2e/dont-execute-code/rector.php
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions e2e/dont-execute-code/src/OutputInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);


final class OutputInterface
{

}
7 changes: 7 additions & 0 deletions e2e/parse-php7-code/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"autoload": {
"psr-4": {
"Foo\\": "src"
}
}
}
14 changes: 14 additions & 0 deletions e2e/parse-php7-code/rector.php
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions e2e/parse-php7-code/src/Foo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Foo;

class Foo
{
public function __construct()
{
$bar = 'baz';
print $bar{2};
}
}
7 changes: 7 additions & 0 deletions e2e/parser-php8-code/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"autoload": {
"psr-4": {
"Foo\\": "src"
}
}
}
14 changes: 14 additions & 0 deletions e2e/parser-php8-code/rector.php
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions e2e/parser-php8-code/src/Foo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Foo;

class Foo
{
public function __construct(
public string $property = 'value',
) {}
}
1 change: 0 additions & 1 deletion src/Application/FileProcessor/PhpFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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;
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2::getLoader();
return ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f::getLoader();
14 changes: 7 additions & 7 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit0e9023fe060840085fb755bf5ce124b2
class ComposerAutoloaderInit8e0c521d0267706f8265fce5c8f6726f
{
private static $loader;

Expand All @@ -22,15 +22,15 @@ public static function getLoader()
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) {
Expand All @@ -42,19 +42,19 @@ public static function getLoader()
$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;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit0e9023fe060840085fb755bf5ce124b2
class ComposerStaticInit8e0c521d0267706f8265fce5c8f6726f
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
Expand Down Expand Up @@ -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);
}
Expand Down
10 changes: 5 additions & 5 deletions vendor/scoper-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
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');
Expand Down Expand Up @@ -92,9 +92,9 @@ function 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')) {
Expand Down

0 comments on commit 9fd49a8

Please sign in to comment.