Skip to content

Commit cc35898

Browse files
committed
feature #915 Use bootstrap.php for tests and environment-specific settings (yceruto)
This PR was squashed before being merged into the master branch (closes #915). Discussion ---------- Use bootstrap.php for tests and environment-specific settings Latest changes according to: * https://symfony.com/doc/current/configuration/dot-env-changes.html * https://symfony.com/blog/new-in-symfony-4-2-define-env-vars-per-environment * https://symfony.com/blog/improvements-to-the-handling-of-env-files-for-all-symfony-versions * and [phpunit recipe](https://github.com/symfony/recipes/blob/6c6ac5bf41c4952e1eeb2bdd2644ca2b4d8ba594/phpunit/phpunit/4.7/phpunit.xml.dist#L8) Commits ------- 3bbe083 Use bootstrap.php for tests and environment-specific settings
2 parents d53dfce + 3bbe083 commit cc35898

File tree

4 files changed

+7
-29
lines changed

4 files changed

+7
-29
lines changed

.env.dist renamed to .env

File renamed without changes.

.env.test

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file will be loaded after .env file and override environment
2+
# variables for your test environment.
3+
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database_test.sqlite

.gitignore

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
/var/*
2-
!/var/cache
3-
/var/cache/*
4-
!var/cache/.gitkeep
5-
!/var/data
6-
!/var/log
7-
/var/log/*
8-
!var/log/.gitkeep
9-
!/var/sessions
10-
/var/sessions/*
11-
!var/sessions/.gitkeep
121
/public/build/fonts/glyphicons-*
132
/public/build/images/glyphicons-*
143

154
###> symfony/framework-bundle ###
16-
/.env
5+
/.env.local
6+
/.env.*.local
177
/public/bundles/
8+
/var/
189
/vendor/
1910
###< symfony/framework-bundle ###
2011

phpunit.xml.dist

+1-17
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,13 @@
55
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
66
backupGlobals="false"
77
colors="true"
8-
bootstrap="vendor/autoload.php"
8+
bootstrap="config/bootstrap.php"
99
>
1010
<php>
1111
<ini name="error_reporting" value="-1" />
1212
<env name="KERNEL_CLASS" value="App\Kernel" />
1313
<env name="SYMFONY_PHPUNIT_VERSION" value="7.1"/>
14-
<!-- define your env variables for the test env here -->
15-
16-
<!-- ###+ doctrine/doctrine-bundle ### -->
17-
<env name="DATABASE_URL" value="sqlite:///data/database_test.sqlite"/>
18-
<!-- ###- doctrine/doctrine-bundle ### -->
19-
20-
<!-- ###+ symfony/swiftmailer-bundle ### -->
21-
<env name="MAILER_URL" value="null://localhost"/>
22-
<!-- ###- symfony/swiftmailer-bundle ### -->
23-
24-
<!-- ###+ symfony/framework-bundle ### -->
2514
<env name="APP_ENV" value="test"/>
26-
<env name="APP_DEBUG" value="1"/>
27-
<env name="APP_SECRET" value="5a79a1c866efef9ca1800f971d689f3e"/>
28-
<!-- env name="TRUSTED_PROXIES" value="127.0.0.1,127.0.0.2" -->
29-
<!-- env name="TRUSTED_HOSTS" value="localhost,example.com" -->
30-
<!-- ###- symfony/framework-bundle ### -->
3115
</php>
3216

3317
<testsuites>

0 commit comments

Comments
 (0)