Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,42 @@ jobs:
- php-version: '8.0'
coverage: false
dependency-versions: 'lowest'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.1'
coverage: false
dependency-versions: 'highest'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.2'
coverage: true
dependency-versions: 'highest'
phpunit-config: 'phpunit.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.3'
coverage: true
coverage: false
dependency-versions: 'highest'
phpunit-config: 'phpunit.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.4'
coverage: false
dependency-versions: 'highest'
phpunit-config: 'phpunit.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.5'
coverage: false
coverage: true
dependency-versions: 'highest'
phpunit-config: 'phpunit.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

Expand Down Expand Up @@ -91,7 +97,7 @@ jobs:

- name: Execute test cases
if: matrix.coverage == false
run: composer test
run: composer test -- --configuration=${{ matrix.phpunit-config }}

- name: Execute test cases with coverage
if: ${{ matrix.coverage }}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ composer.lock
.phpunit.result.cache
.deptrac.cache

/tests/Application/config/reference.php
/tests/Application/var
/tests/Application/secrets

Expand Down
3 changes: 2 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude(['tests/Application/var'])
->notName('bundles.php');
->notName('bundles.php')
->notName('reference.php');

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
Expand Down
19 changes: 9 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,24 @@
"coduo/php-matcher": "^6.0",
"friendsofphp/php-cs-fixer": "^3.6",
"handcraftedinthealps/code-coverage-checker": "^0.2.5",
"jangregor/phpstan-prophecy": "^1.0",
"jangregor/phpstan-prophecy": "^2.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-doctrine": "^1.2",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-symfony": "^1.1",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-symfony": "^2.",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^9.5 || ^10.0 || ^11.0 || ^12.0 || ^13.0",
"qossmic/deptrac-shim": "^0.24.0 || ^1.0",
"rector/rector": "^1.0",
"rector/rector": "^2.0",
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/css-selector": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/debug-bundle": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/dotenv": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/error-handler": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/phpunit-bridge": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"thecodingmachine/phpstan-strict-rules": "^1.0"
"symfony/yaml": "^5.4 || ^6.0 || ^7.0 || ^8.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ parameters:
doctrine:
objectManagerLoader: tests/phpstan/object-manager.php
symfony:
container_xml_path: %currentWorkingDirectory%/tests/Application/var/cache/dev/Sulu_Messenger_Tests_Application_KernelDevDebugContainer.xml
console_application_loader: tests/phpstan/console-application.php
containerXmlPath: %currentWorkingDirectory%/tests/Application/var/cache/dev/Sulu_Messenger_Tests_Application_KernelDevDebugContainer.xml
consoleApplicationLoader: tests/phpstan/console-application.php
46 changes: 46 additions & 0 deletions phpunit-9.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
forceCoversAnnotation="true"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<!-- See: https://symfony.com/doc/current/components/phpunit_bridge.html#modified-phpunit-script -->
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
</php>

<testsuites>
<!-- Run Unit Tests before Functional Tests for better Developer Experience -->
<testsuite name="Project Unit Suite">
<directory>tests/Unit</directory>
</testsuite>

<testsuite name="Project Functional Suite">
<directory>tests/Functional</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
</phpunit>
28 changes: 11 additions & 17 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
forceCoversAnnotation="true"
>
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="true">
<php>
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<ini name="error_reporting" value="-1"/>
<server name="APP_ENV" value="test" force="true"/>
<server name="SHELL_VERBOSITY" value="-1"/>
<!-- See: https://symfony.com/doc/current/components/phpunit_bridge.html#modified-phpunit-script -->
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
</php>
Expand All @@ -21,26 +20,21 @@
<testsuite name="Project Unit Suite">
<directory>tests/Unit</directory>
</testsuite>

<testsuite name="Project Functional Suite">
<directory>tests/Functional</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
</source>

<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
{
try {
$envelope = $stack->next()->handle($envelope, $stack);
} catch (HandlerFailedException $exception) { // @phpstan-ignore-line
} catch (HandlerFailedException $exception) {
throw $exception->getPrevious(); // @phpstan-ignore-line
}

Expand Down
1 change: 1 addition & 0 deletions tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function registerBundles(): iterable
];

foreach ($bundles as $class => $envs) {
// @phpstan-ignore-next-line offsetAccess.invalidOffset
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Application/bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
// @phpstan-ignore-next-line binaryOp.invalid
\putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

Expand All @@ -44,6 +45,7 @@
}
}

// @phpstan-ignore-next-line argument.type
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
Loading
Loading