Skip to content

Commit ecc876c

Browse files
authored
[build] add e2e tests (#12)
* [build] add e2e tests * [build] add e2e workflow
1 parent 54d89a4 commit ecc876c

11 files changed

Lines changed: 144 additions & 1 deletion

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: End to End tests
2+
3+
on:
4+
pull_request: null
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
end_to_end:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: ['7.4', '8.0']
16+
17+
name: PHP ${{ matrix.php }} system tests
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
coverage: none # disable xdebug, pcov
25+
26+
# This workflow runs system tests: Use the Rector application from the source
27+
# checkout to process "fixture" projects in tests/system-tests
28+
# to see if those can be processed successfully
29+
30+
- name: Generate Composer autoloaders in fixture directories
31+
run: |
32+
for FIXTURE in `find e2e -mindepth 1 -maxdepth 1 -type d`; do
33+
(cd $FIXTURE; composer install --no-progress --ansi)
34+
done
35+
36+
- name: Run system tests
37+
run: |
38+
HAS_FAILURES=0
39+
40+
for FIXTURE in `find e2e -mindepth 1 -maxdepth 1 -type d`; do
41+
echo "-----> Running $FIXTURE <-----"
42+
if (cd $FIXTURE; ../../bin/rector process --dry-run --clear-cache); then
43+
echo "-----> Result: OK <-----"
44+
else
45+
echo "-----> Result: FAILED <-----"
46+
HAS_FAILURES=1
47+
fi
48+
done
49+
50+
exit $HAS_FAILURES
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"autoload": {
3+
"psr-4": {
4+
"Symfony\\Component\\Console\\Output\\": "src"
5+
}
6+
}
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Core\Configuration\Option;
6+
use Rector\Set\ValueObject\SetList;
7+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
8+
9+
return static function (ContainerConfigurator $containerConfigurator): void {
10+
$parameters = $containerConfigurator->parameters();
11+
$parameters->set(Option::PATHS, [__DIR__.'/src']);
12+
13+
$containerConfigurator->import(SetList::PHP_53);
14+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
6+
final class OutputInterface
7+
{
8+
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"autoload": {
3+
"psr-4": {
4+
"Foo\\": "src"
5+
}
6+
}
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Core\Configuration\Option;
6+
use Rector\Set\ValueObject\SetList;
7+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
8+
9+
return static function (ContainerConfigurator $containerConfigurator): void {
10+
$parameters = $containerConfigurator->parameters();
11+
$parameters->set(Option::PATHS, [__DIR__.'/src']);
12+
13+
$containerConfigurator->import(SetList::PHP_53);
14+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Foo;
4+
5+
class Foo
6+
{
7+
public function __construct()
8+
{
9+
$bar = 'baz';
10+
print $bar{2};
11+
}
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"autoload": {
3+
"psr-4": {
4+
"Foo\\": "src"
5+
}
6+
}
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Core\Configuration\Option;
6+
use Rector\Set\ValueObject\SetList;
7+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
8+
9+
return static function (ContainerConfigurator $containerConfigurator): void {
10+
$parameters = $containerConfigurator->parameters();
11+
$parameters->set(Option::PATHS, [__DIR__.'/src']);
12+
13+
$containerConfigurator->import(SetList::PHP_53);
14+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Foo;
4+
5+
class Foo
6+
{
7+
public function __construct(
8+
public string $property = 'value',
9+
) {}
10+
}

0 commit comments

Comments
 (0)