Skip to content

Commit 73ef12c

Browse files
committed
Add PHPUnit 11 recipe
1 parent 52d9ace commit 73ef12c

File tree

6 files changed

+98
-0
lines changed

6 files changed

+98
-0
lines changed

phpunit/phpunit/11.1/.env.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='$ecretf0rt3st'

phpunit/phpunit/11.1/bin/phpunit

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
if (!ini_get('date.timezone')) {
5+
ini_set('date.timezone', 'UTC');
6+
}
7+
8+
if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
9+
if (PHP_VERSION_ID >= 80000) {
10+
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
11+
} else {
12+
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
13+
require PHPUNIT_COMPOSER_INSTALL;
14+
PHPUnit\TextUI\Command::main();
15+
}
16+
} else {
17+
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
18+
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
19+
exit(1);
20+
}
21+
22+
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
23+
}

phpunit/phpunit/11.1/manifest.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"copy-from-recipe": {
3+
".env.test": ".env.test",
4+
"phpunit.dist.xml": "phpunit.dist.xml",
5+
"tests/": "tests/",
6+
"bin/": "bin/"
7+
},
8+
"gitignore": [
9+
"/phpunit.xml",
10+
"/.phpunit.cache/"
11+
]
12+
}

phpunit/phpunit/11.1/phpunit.dist.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
4+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
6+
colors="true"
7+
failOnDeprecation="true"
8+
failOnNotice="true"
9+
failOnWarning="true"
10+
bootstrap="tests/bootstrap.php"
11+
cacheDirectory=".phpunit.cache"
12+
>
13+
<php>
14+
<ini name="display_errors" value="1" />
15+
<ini name="error_reporting" value="-1" />
16+
<server name="APP_ENV" value="test" force="true" />
17+
<server name="SHELL_VERBOSITY" value="-1" />
18+
</php>
19+
20+
<testsuites>
21+
<testsuite name="Project Test Suite">
22+
<directory>tests</directory>
23+
</testsuite>
24+
</testsuites>
25+
26+
<source ignoreSuppressionOfDeprecations="true"
27+
ignoreIndirectDeprecations="true"
28+
restrictNotices="true"
29+
restrictWarnings="true"
30+
>
31+
<include>
32+
<directory>src</directory>
33+
</include>
34+
35+
<deprecationTrigger>
36+
<function>trigger_deprecation</function>
37+
<method>Doctrine\Deprecations\Deprecation::trigger</method>
38+
<method>Doctrine\Deprecations\Deprecation::delegateTriggerToBackend</method>
39+
</deprecationTrigger>
40+
</source>
41+
42+
<extensions>
43+
</extensions>
44+
</phpunit>

phpunit/phpunit/11.1/post-install.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* <fg=blue>Write</> test cases in the <comment>tests/</> folder
2+
* Use MakerBundle's <comment>make:test</> command as a shortcut!
3+
* <fg=blue>Run</> the tests with <comment>php bin/phpunit</>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
use Symfony\Component\Dotenv\Dotenv;
4+
5+
require dirname(__DIR__).'/vendor/autoload.php';
6+
7+
if (method_exists(Dotenv::class, 'bootEnv')) {
8+
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
9+
}
10+
11+
if ($_SERVER['APP_DEBUG']) {
12+
umask(0000);
13+
}

0 commit comments

Comments
 (0)