Get rid of config/bootstrap.php for 5.1 apps

This commit is contained in:
Nicolas Grekas
2020-01-29 16:53:59 +01:00
parent 990f591216
commit a0cb2ea41f
45 changed files with 132 additions and 46 deletions
@@ -1 +0,0 @@
../../../../symfony/framework-bundle/3.3/config/bootstrap.php
@@ -1,4 +1,11 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = 'test');
require dirname(__DIR__, 2).'/config/bootstrap.php';
if (file_exists(dirname(__DIR__, 2).'/config/bootstrap.php')) {
require dirname(__DIR__, 2).'/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__, 2).'/.env');
}
@@ -1,7 +1,6 @@
{
"copy-from-recipe": {
"behat.yml.dist": "behat.yml.dist",
"config/": "%CONFIG_DIR%/",
"features/": "features/"
},
"aliases": ["behat"],
-1
View File
@@ -1 +0,0 @@
../../../../symfony/framework-bundle/3.3/config/bootstrap.php
-1
View File
@@ -2,7 +2,6 @@
"copy-from-recipe": {
".env.test": ".env.test",
"phpunit.xml.dist": "phpunit.xml.dist",
"config/": "%CONFIG_DIR%/",
"tests/": "tests/"
},
"gitignore": [
+1 -1
View File
@@ -5,7 +5,7 @@
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="config/bootstrap.php"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
+1
View File
@@ -0,0 +1 @@
../../../symfony/phpunit-bridge/3.3/tests/
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env php
<?php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
}
set_time_limit(0);
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
}
$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
+6
View File
@@ -0,0 +1,6 @@
{
"copy-from-recipe": {
"bin/": "%BIN_DIR%/"
},
"aliases": ["cli"]
}
-1
View File
@@ -1 +0,0 @@
../4.4/config
@@ -0,0 +1 @@
../../../3.3/config/packages/cache.yaml
@@ -0,0 +1,15 @@
framework:
#csrf_protection: true
#http_method_override: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
#esi: true
#fragments: true
php_errors:
log: true
+1
View File
@@ -0,0 +1 @@
../../../4.2/config/packages/test/
+1
View File
@@ -0,0 +1 @@
../../4.4/config/routes/
+1
View File
@@ -0,0 +1 @@
../../4.2/config/services.yaml
+1 -1
View File
@@ -1 +1 @@
../4.4/manifest.json
../4.2/manifest.json
@@ -1 +1 @@
../4.4/post-install.txt
../4.2/post-install.txt
-1
View File
@@ -1 +0,0 @@
../4.4/public
@@ -0,0 +1,30 @@
<?php
use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
@@ -1 +0,0 @@
../../../../symfony/framework-bundle/3.3/config/bootstrap.php
+1 -1
View File
@@ -5,7 +5,7 @@
xsi:noNamespaceSchemaLocation="bin/.phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="config/bootstrap.php"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
@@ -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');
}
+1
View File
@@ -0,0 +1 @@
../3.3/config/
@@ -1 +0,0 @@
../../../../symfony/framework-bundle/3.3/config/bootstrap.php
-15
View File
@@ -1,15 +0,0 @@
{
"copy-from-recipe": {
".env.test": ".env.test",
"bin/": "%BIN_DIR%/",
"config/": "%CONFIG_DIR%/",
"phpunit.xml.dist": "phpunit.xml.dist",
"tests/": "tests/"
},
"gitignore": [
".phpunit",
".phpunit.result.cache",
"/phpunit.xml"
],
"aliases": ["simple-phpunit"]
}
+1
View File
@@ -0,0 +1 @@
../3.3/manifest.json
+1 -1
View File
@@ -5,7 +5,7 @@
xsi:noNamespaceSchemaLocation="bin/.phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="config/bootstrap.php"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
@@ -1,6 +0,0 @@
<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</>
+1
View File
@@ -0,0 +1 @@
../3.3/post-install.txt
+1
View File
@@ -0,0 +1 @@
../3.3/tests/
-1
View File
@@ -1 +0,0 @@
../4.1/.env.test
-1
View File
@@ -1 +0,0 @@
../4.1/bin
@@ -1 +0,0 @@
../../../framework-bundle/4.2/config/bootstrap.php
-1
View File
@@ -1 +0,0 @@
../4.1/manifest.json
@@ -1 +0,0 @@
../4.1/phpunit.xml.dist
@@ -1 +0,0 @@
../4.1/post-install.txt
-1
View File
@@ -1 +0,0 @@
../4.1/tests
+1
View File
@@ -0,0 +1 @@
../3.3/config/
@@ -1 +0,0 @@
../../4.2/config/bootstrap.php
+1 -1
View File
@@ -1 +1 @@
../4.2/manifest.json
../3.3/manifest.json
+1 -1
View File
@@ -1 +1 @@
../4.2/phpunit.xml.dist
../4.1/phpunit.xml.dist
+1 -1
View File
@@ -1 +1 @@
../4.2/post-install.txt
../3.3/post-install.txt
+1
View File
@@ -0,0 +1 @@
../3.3/tests/