Simplify services definition in Behat

This commit is contained in:
Kamil Kokot
2019-01-09 22:37:18 +01:00
parent 11f5a326b3
commit d4efe9a6df
2 changed files with 10 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ Feature: Injecting parameters into context
""" """
Scenario: Injecting a parameter into a context explicitly set as public Scenario: Injecting a parameter into a context explicitly set as public
Given a services file "config/services.yaml" containing: Given a YAML services file containing:
""" """
services: services:
App\Tests\SomeContext: App\Tests\SomeContext:
@@ -47,7 +47,7 @@ Feature: Injecting parameters into context
Then it should pass Then it should pass
Scenario: Injecting a parameter into an autoconfigured context Scenario: Injecting a parameter into an autoconfigured context
Given a services file "config/services.yaml" containing: Given a YAML services file containing:
""" """
services: services:
_defaults: _defaults:

View File

@@ -123,6 +123,14 @@ CON
$this->thereIsFile('config/services.yaml', ''); $this->thereIsFile('config/services.yaml', '');
} }
/**
* @Given /^a YAML services file containing:$/
*/
public function yamlServicesFile($content): void
{
$this->thereIsFile('config/services.yaml', (string) $content);
}
/** /**
* @Given /^a Behat configuration containing(?: "([^"]+)"|:)$/ * @Given /^a Behat configuration containing(?: "([^"]+)"|:)$/
*/ */