Skip to content

Commit cf97100

Browse files
committed
Remove boot/set-env.php file
1 parent de7fb62 commit cf97100

File tree

7 files changed

+23
-57
lines changed

7 files changed

+23
-57
lines changed

boot/app.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
if (is_file(__DIR__ . '/../vendor/autoload.php')) {
99
require_once __DIR__ . '/../vendor/autoload.php';
1010
} else {
11-
require_once __DIR__ . '/set-env.php';
1211
require_once __DIR__ . '/init.php';
1312
require_once __DIR__ . '/constants.php';
1413
require_once BOOT_DIR . 'helpers.php';

boot/init.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
77
*/
8+
if (is_file(__DIR__ . '/../.env.php')) {
9+
require __DIR__ . '/../.env.php';
10+
foreach ($_ENV as $key => $value) {
11+
$_SERVER[$key] = $value;
12+
}
13+
}
14+
815
if (isset($_SERVER['ENVIRONMENT']) && $_SERVER['ENVIRONMENT'] === 'development') {
916
error_reporting(-1);
1017
ini_set('display_errors', 'On');

boot/set-env.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"App.php"
5555
],
5656
"files": [
57-
"boot/set-env.php",
5857
"boot/init.php",
5958
"boot/constants.php",
6059
"boot/helpers.php"

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<file>.env.php</file>
2323
<file>App.php</file>
2424
<file>bin/console</file>
25-
<file>boot/set-env.php</file>
2625
<file>boot/helpers.php</file>
2726
<file>boot/routes.php</file>
2827
<file>public/index.php</file>

tests/boot/InitTest.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,36 @@
1313
#[RunTestsInSeparateProcesses]
1414
final class InitTest extends TestCase
1515
{
16-
protected function loadInitFile() : static
16+
protected function setUp() : void
1717
{
18+
\ob_start();
1819
require __DIR__ . '/../../boot/init.php';
19-
return $this;
20+
\ob_end_clean();
2021
}
2122

22-
public function testDevelopmentEnvironment() : void
23+
public function testErrorReporting() : void
2324
{
24-
$_SERVER['ENVIRONMENT'] = 'development';
25-
$this->loadInitFile();
26-
self::assertSame(-1, \error_reporting());
27-
self::assertSame('On', \ini_get('display_errors'));
28-
}
29-
30-
public function testProductionEnvironment() : void
31-
{
32-
$_SERVER['ENVIRONMENT'] = 'production';
33-
$this->loadInitFile();
25+
if ($_SERVER['ENVIRONMENT'] === 'development') {
26+
self::assertSame(-1, \error_reporting());
27+
return;
28+
}
3429
self::assertSame(
3530
\E_ALL & ~\E_DEPRECATED & ~\E_NOTICE & ~\E_USER_DEPRECATED & ~\E_USER_NOTICE,
3631
\error_reporting()
3732
);
33+
}
34+
35+
public function testDisplayErrors() : void
36+
{
37+
if ($_SERVER['ENVIRONMENT'] === 'development') {
38+
self::assertSame('On', \ini_get('display_errors'));
39+
return;
40+
}
3841
self::assertSame('Off', \ini_get('display_errors'));
3942
}
4043

4144
public function testDefaultTimezone() : void
4245
{
43-
$this->loadInitFile();
4446
self::assertSame('UTC', \date_default_timezone_get());
4547
}
4648
}

tests/boot/SetEnvTest.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)