mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-18 09:02:26 +00:00
[build] add e2e tests (#12)
* [build] add e2e tests * [build] add e2e workflow
This commit is contained in:
parent
54d89a4a41
commit
ecc876ca19
50
build/target-repository/.github/workflows/e2e.yaml
vendored
Normal file
50
build/target-repository/.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
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Console\\Output\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
14
build/target-repository/e2e/dont-execute-code/rector.php
Normal file
14
build/target-repository/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);
|
||||
};
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
final class OutputInterface
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Foo\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
14
build/target-repository/e2e/parse-php7-code/rector.php
Normal file
14
build/target-repository/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
build/target-repository/e2e/parse-php7-code/src/Foo.php
Normal file
12
build/target-repository/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};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Foo\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
14
build/target-repository/e2e/parser-php8-code/rector.php
Normal file
14
build/target-repository/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
build/target-repository/e2e/parser-php8-code/src/Foo.php
Normal file
10
build/target-repository/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',
|
||||
) {}
|
||||
}
|
|
@ -9,7 +9,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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user