Add autoconfiguration for Symfony 4, allow overriding .env setting by using explicit env and debug settings, tweaks
This commit is contained in:
@@ -3,7 +3,7 @@ Feature: Not crashing Behat
|
||||
As a Behat User
|
||||
I want to have Behat up and running after enabling this extension
|
||||
|
||||
Scenario: Not crashing Behat
|
||||
Scenario: Successful boot the Symfony kernel with autoconfiguration
|
||||
Given a Behat configuration containing:
|
||||
"""
|
||||
default:
|
||||
@@ -29,7 +29,7 @@ Feature: Not crashing Behat
|
||||
When I run Behat
|
||||
Then it should pass
|
||||
|
||||
Scenario: Not crashing Behat with CrossContainerExtension
|
||||
Scenario: Successful boot the Symfony kernel with explicit configuration
|
||||
Given a Behat configuration containing:
|
||||
"""
|
||||
default:
|
||||
@@ -37,17 +37,19 @@ Feature: Not crashing Behat
|
||||
FriendsOfBehat\SymfonyExtension:
|
||||
kernel:
|
||||
bootstrap: ~
|
||||
|
||||
FriendsOfBehat\CrossContainerExtension: ~
|
||||
path: app/MyKernel.php
|
||||
class: MyKernel
|
||||
env: test
|
||||
debug: true
|
||||
"""
|
||||
And a file "app/AppKernel.php" containing:
|
||||
And a file "app/MyKernel.php" containing:
|
||||
"""
|
||||
<?php
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
|
||||
class AppKernel extends Kernel
|
||||
class MyKernel extends Kernel
|
||||
{
|
||||
public function registerBundles() { return []; }
|
||||
public function registerContainerConfiguration(LoaderInterface $loader) {}
|
||||
@@ -57,7 +59,38 @@ Feature: Not crashing Behat
|
||||
When I run Behat
|
||||
Then it should pass
|
||||
|
||||
Scenario: This extension boot a Symfony4 kernel
|
||||
|
||||
Scenario: Successful boot the Symfony 4 kernel with autoconfiguration
|
||||
Given a Behat configuration containing:
|
||||
"""
|
||||
default:
|
||||
extensions:
|
||||
FriendsOfBehat\SymfonyExtension: ~
|
||||
"""
|
||||
And a file ".env" containing:
|
||||
"""
|
||||
APP_ENV=dev
|
||||
"""
|
||||
And a file "src/Kernel.php" containing:
|
||||
"""
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
|
||||
class Kernel extends BaseKernel
|
||||
{
|
||||
public function registerBundles() { return []; }
|
||||
public function registerContainerConfiguration(LoaderInterface $loader) {}
|
||||
}
|
||||
"""
|
||||
And a feature file with passing scenario
|
||||
When I run Behat
|
||||
Then it should pass
|
||||
|
||||
Scenario: Successful boot the Symfony 4 kernel with explicit configuration
|
||||
Given a Behat configuration containing:
|
||||
"""
|
||||
default:
|
||||
@@ -98,9 +131,11 @@ Feature: Not crashing Behat
|
||||
FriendsOfBehat\SymfonyExtension:
|
||||
env_file: .env_in_memory
|
||||
kernel:
|
||||
bootstrap: ~
|
||||
path: src/MyKernel.php
|
||||
class: MyKernel
|
||||
bootstrap: ~
|
||||
env: dev
|
||||
debug: true
|
||||
"""
|
||||
And a file ".env_in_memory.dist" containing:
|
||||
"""
|
||||
@@ -122,3 +157,31 @@ Feature: Not crashing Behat
|
||||
And a feature file with passing scenario
|
||||
When I run Behat
|
||||
Then it should pass
|
||||
|
||||
Scenario: Not crashing Behat with CrossContainerExtension
|
||||
Given a Behat configuration containing:
|
||||
"""
|
||||
default:
|
||||
extensions:
|
||||
FriendsOfBehat\SymfonyExtension:
|
||||
kernel:
|
||||
bootstrap: ~
|
||||
|
||||
FriendsOfBehat\CrossContainerExtension: ~
|
||||
"""
|
||||
And a file "app/AppKernel.php" containing:
|
||||
"""
|
||||
<?php
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
|
||||
class AppKernel extends Kernel
|
||||
{
|
||||
public function registerBundles() { return []; }
|
||||
public function registerContainerConfiguration(LoaderInterface $loader) {}
|
||||
}
|
||||
"""
|
||||
And a feature file with passing scenario
|
||||
When I run Behat
|
||||
Then it should pass
|
||||
|
||||
Reference in New Issue
Block a user