mirror of
https://github.com/symfony/recipes.git
synced 2026-09-13 08:06:23 +03:00
183 lines
9.0 KiB
JSON
183 lines
9.0 KiB
JSON
{
|
|
"manifests": {
|
|
"symfony/phpunit-bridge": {
|
|
"manifest": {
|
|
"copy-from-recipe": {
|
|
".env.test": ".env.test",
|
|
"bin/": "%BIN_DIR%/",
|
|
"config/": "%CONFIG_DIR%/",
|
|
"phpunit.xml.dist": "phpunit.xml.dist",
|
|
"tests/": "tests/"
|
|
},
|
|
"gitignore": [
|
|
".phpunit",
|
|
"/phpunit.xml"
|
|
],
|
|
"post-install-output": [
|
|
"<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",
|
|
" * <fg=blue>Run</> <comment>php bin/phpunit</>"
|
|
]
|
|
},
|
|
"files": {
|
|
".env.test": {
|
|
"contents": [
|
|
"# define your env variables for the test env here",
|
|
"KERNEL_CLASS='App\\Kernel'",
|
|
"APP_SECRET='$ecretf0rt3st'",
|
|
"SYMFONY_DEPRECATIONS_HELPER=999999",
|
|
""
|
|
],
|
|
"executable": false
|
|
},
|
|
"bin/phpunit": {
|
|
"contents": [
|
|
"#!/usr/bin/env php",
|
|
"<?php",
|
|
"",
|
|
"if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {",
|
|
" echo \"Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\\n\";",
|
|
" exit(1);",
|
|
"}",
|
|
"",
|
|
"if (false === getenv('SYMFONY_PHPUNIT_VERSION')) {",
|
|
" putenv('SYMFONY_PHPUNIT_VERSION=6.5');",
|
|
"}",
|
|
"if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) {",
|
|
" putenv('SYMFONY_PHPUNIT_REMOVE=symfony/yaml');",
|
|
"}",
|
|
"if (false === getenv('SYMFONY_PHPUNIT_DIR')) {",
|
|
" putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');",
|
|
"}",
|
|
"",
|
|
"require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';",
|
|
""
|
|
],
|
|
"executable": true
|
|
},
|
|
"config/bootstrap.php": {
|
|
"contents": [
|
|
"<?php",
|
|
"",
|
|
"use Symfony\\Component\\Dotenv\\Dotenv;",
|
|
"",
|
|
"require dirname(__DIR__).'/vendor/autoload.php';",
|
|
"",
|
|
"// Load cached env vars if the .env.local.php file exists",
|
|
"// Run \"composer dump-env prod\" to create it (requires symfony/flex >=1.2)",
|
|
"if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {",
|
|
" foreach ($env as $k => $v) {",
|
|
" $_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);",
|
|
" }",
|
|
"} elseif (!class_exists(Dotenv::class)) {",
|
|
" throw new RuntimeException('Please run \"composer require symfony/dotenv\" to load the \".env\" files configuring the application.');",
|
|
"} else {",
|
|
" $path = dirname(__DIR__).'/.env';",
|
|
" $dotenv = new Dotenv(false);",
|
|
"",
|
|
" // load all the .env files",
|
|
" if (method_exists($dotenv, 'loadEnv')) {",
|
|
" $dotenv->loadEnv($path);",
|
|
" } else {",
|
|
" // fallback code in case your Dotenv component is not 4.2 or higher (when loadEnv() was added)",
|
|
"",
|
|
" if (file_exists($path) || !file_exists($p = \"$path.dist\")) {",
|
|
" $dotenv->load($path);",
|
|
" } else {",
|
|
" $dotenv->load($p);",
|
|
" }",
|
|
"",
|
|
" if (null === $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) {",
|
|
" $dotenv->populate(array('APP_ENV' => $env = 'dev'));",
|
|
" }",
|
|
"",
|
|
" if ('test' !== $env && file_exists($p = \"$path.local\")) {",
|
|
" $dotenv->load($p);",
|
|
" $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env;",
|
|
" }",
|
|
"",
|
|
" if (file_exists($p = \"$path.$env\")) {",
|
|
" $dotenv->load($p);",
|
|
" }",
|
|
"",
|
|
" if (file_exists($p = \"$path.$env.local\")) {",
|
|
" $dotenv->load($p);",
|
|
" }",
|
|
" }",
|
|
"}",
|
|
"",
|
|
"$_SERVER += $_ENV;",
|
|
"$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';",
|
|
"$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];",
|
|
"$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';",
|
|
""
|
|
],
|
|
"executable": false
|
|
},
|
|
"config/services_test.yaml": {
|
|
"contents": [
|
|
"services:",
|
|
" _defaults:",
|
|
" public: true",
|
|
"",
|
|
" # If you need to access services in a test, create an alias",
|
|
" # and then fetch that alias from the container. As a convention,",
|
|
" # aliases are prefixed with test. For example:",
|
|
" #",
|
|
" # test.App\\Service\\MyService: '@App\\Service\\MyService'",
|
|
""
|
|
],
|
|
"executable": false
|
|
},
|
|
"phpunit.xml.dist": {
|
|
"contents": [
|
|
"<?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=\"bin/.phpunit/phpunit.xsd\"",
|
|
" backupGlobals=\"false\"",
|
|
" colors=\"true\"",
|
|
" bootstrap=\"config/bootstrap.php\"",
|
|
">",
|
|
" <php>",
|
|
" <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>",
|
|
"",
|
|
" <filter>",
|
|
" <whitelist>",
|
|
" <directory>src</directory>",
|
|
" </whitelist>",
|
|
" </filter>",
|
|
"",
|
|
" <listeners>",
|
|
" <listener class=\"Symfony\\Bridge\\PhpUnit\\SymfonyTestsListener\" />",
|
|
" </listeners>",
|
|
"</phpunit>",
|
|
""
|
|
],
|
|
"executable": false
|
|
},
|
|
"tests/.gitignore": {
|
|
"contents": [
|
|
""
|
|
],
|
|
"executable": false
|
|
}
|
|
},
|
|
"ref": "33e147b643473a858f2c5e0ae761f149faebe06e"
|
|
}
|
|
}
|
|
}
|