Skip to content

Commit

Permalink
Add "system level" tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude committed Mar 6, 2021
1 parent 031deda commit 7c63577
Show file tree
Hide file tree
Showing 39 changed files with 2,013 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/php_linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
actions:
-
php_version: 7.3
run: vendor/bin/parallel-lint src bin/rector config tests packages rules --colors --exclude packages/rector-generator/templates --exclude rules/psr4/tests/Rector/Namespace_/MultipleClassFileToPsr4ClassesRector/Source --exclude rules/autodiscovery/tests/Rector/FileNode/MoveInterfacesToContractNamespaceDirectoryRector/Expected --exclude packages/node-type-resolver/tests/PerNodeTypeResolver/PropertyFetchTypeResolver/Source/ClassWithNativeProps.php --exclude packages/node-type-resolver/tests/PerNodeTypeResolver/PropertyFetchTypeResolver/Source/ClassWithNativePropsPhp80.php --exclude packages/node-type-resolver/tests/PerNodeTypeResolver/PropertyFetchTypeResolver/Source/ClassWithTypedPropertyTypes.php --exclude rules/nette-kdyby/tests/Rector/MethodCall/ReplaceEventManagerWithEventSubscriberRector/Source/ExpectedSomeClassCopyEvent.php --exclude rules/nette-kdyby/tests/Rector/MethodCall/ReplaceMagicPropertyEventWithEventClassRector/Source/ExpectedFileManagerUploadEvent.php --exclude rules/nette-kdyby/tests/Rector/MethodCall/ReplaceMagicPropertyEventWithEventClassRector/Source/ExpectedDuplicatedEventParamsUploadEvent.php --exclude rules/type-declaration/tests/Rector/ClassMethod/ParamTypeFromStrictTypedPropertyRector/Source/OutOfControlExternalClass.php
run: vendor/bin/parallel-lint src bin/rector config tests packages rules --colors --exclude tests/system-tests --exclude packages/rector-generator/templates --exclude rules/psr4/tests/Rector/Namespace_/MultipleClassFileToPsr4ClassesRector/Source --exclude rules/autodiscovery/tests/Rector/FileNode/MoveInterfacesToContractNamespaceDirectoryRector/Expected --exclude packages/node-type-resolver/tests/PerNodeTypeResolver/PropertyFetchTypeResolver/Source/ClassWithNativeProps.php --exclude packages/node-type-resolver/tests/PerNodeTypeResolver/PropertyFetchTypeResolver/Source/ClassWithNativePropsPhp80.php --exclude packages/node-type-resolver/tests/PerNodeTypeResolver/PropertyFetchTypeResolver/Source/ClassWithTypedPropertyTypes.php --exclude rules/nette-kdyby/tests/Rector/MethodCall/ReplaceEventManagerWithEventSubscriberRector/Source/ExpectedSomeClassCopyEvent.php --exclude rules/nette-kdyby/tests/Rector/MethodCall/ReplaceMagicPropertyEventWithEventClassRector/Source/ExpectedFileManagerUploadEvent.php --exclude rules/nette-kdyby/tests/Rector/MethodCall/ReplaceMagicPropertyEventWithEventClassRector/Source/ExpectedDuplicatedEventParamsUploadEvent.php --exclude rules/type-declaration/tests/Rector/ClassMethod/ParamTypeFromStrictTypedPropertyRector/Source/OutOfControlExternalClass.php

-
php_version: 8.0
run: vendor/bin/parallel-lint src bin/rector config tests packages rules --colors --exclude packages/rector-generator/templates
run: vendor/bin/parallel-lint src bin/rector config tests packages rules --colors --exclude tests/system-tests --exclude packages/rector-generator/templates

runs-on: ubuntu-latest

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ jobs:
if: "matrix.dependencies != 'lowest'"

- run: vendor/bin/phpunit

- run: tests/system-tests/run-tests.sh
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ parameters:
# tests
- tests/DependencyInjection/config

# system-level tests
- tests/system-tests

ignoreErrors:
- '#Parameter \#1 \$children of class PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocNode constructor expects array<PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocChildNode\>, array<int, PHPStan\\PhpDocParser\\Ast\\Node\> given#'

Expand Down
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<exclude>packages/rector-generator/templates/*</exclude>
<exclude>packages/rector-generator/tests/RectorGenerator/Fixture/expected</exclude>
<exclude>rules/nette-tester-to-phpunit/tests/Rector/RenameTesterTestToPHPUnitToTestFileRector/Source/*</exclude>
<exclude>tests/system-tests</exclude>
</testsuite>
</testsuites>
</phpunit>
1 change: 1 addition & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
'*/Fixture/*',
'*/Source/*',
'*/Expected/*',
__DIR__ . '/tests/system-tests/*/vendor',

__DIR__ . '/packages/doctrine-annotation-generated/src',
// template files
Expand Down
7 changes: 7 additions & 0 deletions tests/system-tests/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"
}
}
}
17 changes: 17 additions & 0 deletions tests/system-tests/dont-execute-code/rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Property\TypedPropertyRector;
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']);
$parameters->set(Option::SKIP, [__DIR__.'/vendor']);

$parameters->set(Option::SETS, [SetList::PHP_53]);
};

7 changes: 7 additions & 0 deletions tests/system-tests/dont-execute-code/src/OutputInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Symfony\Component\Console\Output;

use Exception;

throw new Exception('Running code from ' . __FILE__);
7 changes: 7 additions & 0 deletions tests/system-tests/dont-execute-code/vendor/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

// autoload.php @generated by Composer

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

return ComposerAutoloaderInitee05d1830576a76d45b8947c45d857b7::getLoader();
Loading

0 comments on commit 7c63577

Please sign in to comment.