Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9914b1a

Browse filesBrowse files
author
Emmanuel BORGES
committed
fix SYMFONY_DEPRECATIONS_HELPER env is empty in bootstrap
1 parent b296860 commit 9914b1a
Copy full SHA for 9914b1a

File tree

1 file changed

+17
-0
lines changed
Filter options

1 file changed

+17
-0
lines changed

‎src/Symfony/Bridge/PhpUnit/bootstrap.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/bootstrap.php
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@
3535
}
3636
}
3737

38+
// load an .env.test file for override phpunit.xml(.dist) vars
39+
$path = dirname(getenv('SYMFONY_PHPUNIT_DIR'), 2);
40+
if (file_exists($path.'/vendor/autoload.php')) {
41+
$loader = clone require $path.'/vendor/autoload.php';
42+
if (!class_exists(\Symfony\Component\Dotenv\Dotenv::class)) {
43+
throw new \RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
44+
}
45+
46+
$dotenv = new \Symfony\Component\Dotenv\Dotenv();
47+
$path .= '/.env.'.(false !== getenv('APP_ENV') ? getenv('APP_ENV'): 'test');
48+
if (file_exists($p = $path)) {
49+
$dotenv->load($p);
50+
}
51+
52+
$loader->unregister();
53+
}
54+
3855
if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) {
3956
DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
4057
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.