mirror of
https://github.com/symfony/recipes.git
synced 2026-09-18 10:36:43 +03:00
Add PHPUnit 11 recipe, treat PHPUnitBridge only as a PHPUnit extension (#1401)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "phpunit.dist.xml",
|
||||
"content": " <method>Doctrine\\Deprecations\\Deprecation::trigger</method>\n <method>Doctrine\\Deprecations\\Deprecation::delegateTriggerToBackend</method>",
|
||||
"position": "after_target",
|
||||
"target": "<deprecationTrigger>",
|
||||
"warn_if_missing": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# define your env variables for the test env here
|
||||
KERNEL_CLASS='App\Kernel'
|
||||
APP_SECRET='$ecretf0rt3st'
|
||||
Executable
+23
@@ -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';
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "phpunit.dist.xml",
|
||||
"content": " <method>Doctrine\\Deprecations\\Deprecation::trigger</method>\n <method>Doctrine\\Deprecations\\Deprecation::delegateTriggerToBackend</method>",
|
||||
"position": "after_target",
|
||||
"target": "<deprecationTrigger>",
|
||||
"requires": ["doctrine/deprecations"]
|
||||
}
|
||||
],
|
||||
"copy-from-recipe": {
|
||||
".env.test": ".env.test",
|
||||
"phpunit.dist.xml": "phpunit.dist.xml",
|
||||
"tests/": "tests/",
|
||||
"bin/": "%BIN_DIR%/"
|
||||
},
|
||||
"gitignore": [
|
||||
"/phpunit.xml",
|
||||
"/.phpunit.cache/"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
colors="true"
|
||||
failOnDeprecation="true"
|
||||
failOnNotice="true"
|
||||
failOnWarning="true"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
>
|
||||
<php>
|
||||
<ini name="display_errors" value="1" />
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<server name="APP_ENV" value="test" force="true" />
|
||||
<server name="SHELL_VERBOSITY" value="-1" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Project Test Suite">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<source ignoreSuppressionOfDeprecations="true"
|
||||
ignoreIndirectDeprecations="true"
|
||||
restrictNotices="true"
|
||||
restrictWarnings="true"
|
||||
>
|
||||
<include>
|
||||
<directory>src</directory>
|
||||
</include>
|
||||
|
||||
<deprecationTrigger>
|
||||
<function>trigger_deprecation</function>
|
||||
</deprecationTrigger>
|
||||
</source>
|
||||
|
||||
<extensions>
|
||||
</extensions>
|
||||
</phpunit>
|
||||
@@ -0,0 +1,3 @@
|
||||
* <fg=blue>Write</> test cases in the <comment>tests/</> folder
|
||||
* Use MakerBundle's <comment>make:test</> command as a shortcut!
|
||||
* <fg=blue>Run</> the tests with <comment>php bin/phpunit</>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
|
||||
require dirname(__DIR__).'/vendor/autoload.php';
|
||||
|
||||
if (method_exists(Dotenv::class, 'bootEnv')) {
|
||||
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||
}
|
||||
|
||||
if ($_SERVER['APP_DEBUG']) {
|
||||
umask(0000);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "phpunit.dist.xml",
|
||||
"content": " <bootstrap class=\"Symfony\\Bridge\\PhpUnit\\SymfonyExtension\">\n <parameter name=\"clock-mock-namespaces\" value=\"App\" />\n <parameter name=\"dns-mock-namespaces\" value=\"App\" />\n </bootstrap>",
|
||||
"position": "after_target",
|
||||
"target": "<extensions>",
|
||||
"warn_if_missing": true
|
||||
}
|
||||
],
|
||||
"conflict": {
|
||||
"phpunit/phpunit": "<10.0",
|
||||
"symfony/framework-bundle": "<5.4"
|
||||
},
|
||||
"aliases": ["simple-phpunit"]
|
||||
}
|
||||
Reference in New Issue
Block a user