Skip to content

Commit

Permalink
Never use phpunit directly - only use the bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
Zombaya committed Dec 9, 2023
1 parent 9f23159 commit 191156a
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 24 deletions.
10 changes: 7 additions & 3 deletions demo/symfony5.4/bin/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ if (!ini_get('date.timezone')) {
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
Expand Down
6 changes: 1 addition & 5 deletions demo/symfony5.4/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.6" />
</php>

<testsuites>
Expand All @@ -33,10 +33,6 @@
<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>
6 changes: 3 additions & 3 deletions demo/symfony5.4/symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@
]
},
"symfony/phpunit-bridge": {
"version": "6.3",
"version": "7.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.3",
"ref": "819d3d2ffa4590eba0b8f4f3e5e89415ee4e45c3"
"version": "6.3",
"ref": "1f5830c331065b6e4c9d5fa2105e322d29fcd573"
},
"files": [
".env.test",
Expand Down
23 changes: 23 additions & 0 deletions demo/symfony7.x/bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}
8 changes: 4 additions & 4 deletions demo/symfony7.x/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"symfony/twig-bundle": "7.0.*",
"symfony/yaml": "7.0.*"
},
"require-dev": {
"symfony/phpunit-bridge": "^7.0"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
Expand Down Expand Up @@ -70,8 +73,5 @@
"type": "path",
"url": "../../"
}
],
"require-dev": {
"phpunit/phpunit": "^10.5"
}
]
}
98 changes: 89 additions & 9 deletions demo/symfony7.x/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions demo/symfony7.x/symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@
"src/Kernel.php"
]
},
"symfony/phpunit-bridge": {
"version": "7.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.3",
"ref": "1f5830c331065b6e4c9d5fa2105e322d29fcd573"
},
"files": [
".env.test",
"bin/phpunit",
"phpunit.xml.dist",
"tests/bootstrap.php"
]
},
"symfony/routing": {
"version": "7.0",
"recipe": {
Expand Down

0 comments on commit 191156a

Please sign in to comment.