Skip to content

Commit df2db6b

Browse files
committed
Speed-up Travis
1 parent 3aa9d0b commit df2db6b

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ matrix:
1717
- php: '7.0'
1818
- php: '7.1'
1919
- php: '7.2'
20+
- php: '7.2'
21+
env: coverage=1
2022
- php: '7.2'
2123
env: lint=1
2224
- php: '7.2'
2325
env: deps=low
24-
- php: '7.2'
25-
env: coverage=1
2626
- php: '7.2'
2727
env: SYMFONY_DEPRECATIONS_HELPER=0
2828
- php: '7.2'
@@ -75,9 +75,9 @@ install:
7575

7676
script:
7777
- if [[ $coverage = 1 ]]; then
78-
phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-phpunit.cov;
78+
APP_ENV=test_phpunit phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-phpunit.cov;
7979
elif [[ $lint != 1 ]]; then
80-
vendor/bin/phpunit;
80+
APP_ENV=test_phpunit vendor/bin/phpunit;
8181
fi
8282
- if [[ $coverage = 1 ]]; then
8383
for f in $(find features -name '*.feature' -not -path 'features/main/exposed_state.feature'); do

behat.yml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ default:
3131
extensions:
3232
'Behat\Symfony2Extension':
3333
kernel:
34-
env: '%env(APP_ENV)%'
34+
env: 'test'
3535
debug: 'true'
3636
path: 'tests/Fixtures/app/AppKernel.php'
3737
bootstrap: 'tests/Fixtures/app/bootstrap.php'

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<ini name="memory_limit" value="-1" />
1313
<server name="KERNEL_DIR" value="tests/Fixtures/app/" />
1414
<server name="KERNEL_CLASS" value="AppKernel" />
15+
<server name="APP_ENV" value="test_phpunit" />
1516
<server name="LEGACY" value="0" />
1617
</php>
1718

tests/Fixtures/app/AppKernel.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ class AppKernel extends Kernel
3838
{
3939
use MicroKernelTrait;
4040

41+
public function __construct(string $environment, bool $debug)
42+
{
43+
parent::__construct($environment, $debug);
44+
45+
// patch for behat/symfony2-extension not supporting %env(APP_ENV)%
46+
$this->environment = $_SERVER['APP_ENV'] ?? $environment;
47+
}
48+
4149
public function registerBundles(): array
4250
{
4351
$bundles = [
@@ -69,15 +77,9 @@ protected function configureRoutes(RouteCollectionBuilder $routes)
6977

7078
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
7179
{
72-
$environment = $this->getEnvironment();
7380
$c->setParameter('kernel.project_dir', __DIR__);
7481

75-
// patch for behat not supporting %env(APP_ENV)% in older versions
76-
if (($appEnv = $_SERVER['APP_ENV'] ?? 'test') && $appEnv !== $environment) {
77-
$environment = $appEnv;
78-
}
79-
80-
$loader->load("{$this->getRootDir()}/config/config_{$environment}.yml");
82+
$loader->load("{$this->getRootDir()}/config/config_{$this->getEnvironment()}.yml");
8183

8284
$securityConfig = [
8385
'encoders' => [
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
imports:
2+
- { resource: config_test.yml }

0 commit comments

Comments
 (0)