mirror of
https://github.com/symfony/recipes.git
synced 2026-09-11 23:26:27 +03:00
Merge pull request #906
This commit is contained in:
@@ -2,3 +2,5 @@
|
||||
KERNEL_CLASS='App\Kernel'
|
||||
APP_SECRET='$ecretf0rt3st'
|
||||
SYMFONY_DEPRECATIONS_HELPER=999999
|
||||
PANTHER_APP_ENV=panther
|
||||
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
|
||||
|
||||
@@ -24,4 +24,18 @@
|
||||
<directory suffix=".php">src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
<!-- Run `composer require symfony/phpunit-bridge` before enabling this extension -->
|
||||
<!--
|
||||
<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>
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<bg=yellow;fg=black> </>
|
||||
<bg=yellow;fg=black> Suggest: install Symfony's PHPUnit Bridge instead of phpunit/phpunit </>
|
||||
<bg=yellow;fg=black> </>
|
||||
|
||||
Symfony's PHPUnit bridge is a wrapper around PHPUnit that adds reports for deprecated code
|
||||
calls, an isolated PHPUnit that's separate from the dependencies of your app and more.
|
||||
See: https://symfony.com/doc/current/components/phpunit_bridge.html.
|
||||
|
||||
* <fg=blue>If you want to install the PHPUnit bridge</>:
|
||||
1. Remove PHPUnit: <comment>composer remove --dev phpunit/phpunit</>
|
||||
2. Install Symfony's bridge: <comment>composer require --dev symfony/phpunit-bridge</>
|
||||
@@ -0,0 +1,6 @@
|
||||
# define your env variables for the test env here
|
||||
KERNEL_CLASS='App\Kernel'
|
||||
APP_SECRET='$ecretf0rt3st'
|
||||
SYMFONY_DEPRECATIONS_HELPER=999999
|
||||
PANTHER_APP_ENV=panther
|
||||
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
if (file_exists(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
|
||||
require(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit');
|
||||
} else {
|
||||
if (!file_exists(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);
|
||||
}
|
||||
|
||||
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
|
||||
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
|
||||
}
|
||||
|
||||
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"copy-from-recipe": {
|
||||
".env.test": ".env.test",
|
||||
"bin/": "%BIN_DIR%/",
|
||||
"phpunit.xml.dist": "phpunit.xml.dist",
|
||||
"tests/": "tests/"
|
||||
},
|
||||
"gitignore": [
|
||||
".phpunit",
|
||||
".phpunit.result.cache",
|
||||
"/phpunit.xml"
|
||||
],
|
||||
"aliases": ["simple-phpunit"]
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||
<!-- If you use phpunit-bridge directly, set -->
|
||||
<!-- xsi:noNamespaceSchemaLocation="bin/.phpunit/phpunit.xsd" -->
|
||||
<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"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<server name="APP_ENV" value="test" force="true" />
|
||||
<server name="SHELL_VERBOSITY" value="-1" />
|
||||
<!-- If you use phpunit-bridge directly, you can control extra behavior -->
|
||||
<!--
|
||||
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
|
||||
<server name="SYMFONY_PHPUNIT_VERSION" value="8.5" />
|
||||
-->
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Project Test Suite">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,7 @@
|
||||
<bg=blue;fg=white> </>
|
||||
<bg=blue;fg=white> How to test? </>
|
||||
<bg=blue;fg=white> </>
|
||||
|
||||
* <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,11 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
|
||||
require dirname(__DIR__).'/vendor/autoload.php';
|
||||
|
||||
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
|
||||
require dirname(__DIR__).'/config/bootstrap.php';
|
||||
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
|
||||
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||
}
|
||||
Reference in New Issue
Block a user