Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
190 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/behat/extensions/DummyExtension/Context/DummyContext.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* @author Sergii Bondarenko, <sb@firstvector.org> | ||
*/ | ||
namespace Behat\Tests\DummyExtension\Context; | ||
|
||
/** | ||
* Class DummyContext. | ||
* | ||
* @package Behat\Tests\DummyExtension\Context | ||
*/ | ||
class DummyContext extends RawDummyContext | ||
{ | ||
/** | ||
* @Then dummy step | ||
*/ | ||
public function dummyStep() | ||
{ | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
tests/behat/extensions/DummyExtension/Context/DummyContextInitializer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* @author Sergii Bondarenko, <sb@firstvector.org> | ||
*/ | ||
namespace Behat\Tests\DummyExtension\Context; | ||
|
||
use Behat\Behat\Context\Context; | ||
use Behat\Behat\Context\Initializer\ContextInitializer; | ||
|
||
/** | ||
* Class DummyContextInitializer. | ||
* | ||
* @package Behat\Tests\DummyExtension\Context | ||
*/ | ||
class DummyContextInitializer implements ContextInitializer | ||
{ | ||
/** | ||
* Parameters of context. | ||
* | ||
* @var array | ||
*/ | ||
private $parameters = []; | ||
|
||
/** | ||
* @param array $parameters | ||
*/ | ||
public function __construct(array $parameters) | ||
{ | ||
$this->parameters = $parameters; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function initializeContext(Context $context) | ||
{ | ||
if ($context instanceof DummyContextInterface) { | ||
$context->setParameters($this->parameters); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/behat/extensions/DummyExtension/Context/DummyContextInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* @author Sergii Bondarenko, <sb@firstvector.org> | ||
*/ | ||
namespace Behat\Tests\DummyExtension\Context; | ||
|
||
use Behat\Behat\Context\Context; | ||
|
||
/** | ||
* Interface DummyContextInterface. | ||
* | ||
* @package Behat\Tests\DummyExtension\Context | ||
*/ | ||
interface DummyContextInterface extends Context | ||
{ | ||
/** | ||
* Set parameters from behat.yml. | ||
* | ||
* @param array $parameters | ||
* An array of parameters from configuration file. | ||
*/ | ||
public function setParameters(array $parameters); | ||
} |
41 changes: 41 additions & 0 deletions
41
tests/behat/extensions/DummyExtension/Context/RawDummyContext.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* @author Sergii Bondarenko, <sb@firstvector.org> | ||
*/ | ||
namespace Behat\Tests\DummyExtension\Context; | ||
|
||
/** | ||
* Class RawDummyContext. | ||
* | ||
* @package Behat\Tests\DummyExtension\Context | ||
*/ | ||
class RawDummyContext implements DummyContextInterface | ||
{ | ||
/** | ||
* Parameters of context. | ||
* | ||
* @var array | ||
*/ | ||
private $parameters = []; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setParameters(array $parameters) | ||
{ | ||
if (empty($this->parameters)) { | ||
$this->parameters = $parameters; | ||
} | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* The name of parameter from behat.yml. | ||
* | ||
* @return mixed | ||
*/ | ||
protected function getParameter($name) | ||
{ | ||
return isset($this->parameters[$name]) ? $this->parameters[$name] : false; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
tests/behat/extensions/DummyExtension/ServiceContainer/DummyExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
/** | ||
* @author Sergii Bondarenko, <sb@firstvector.org> | ||
*/ | ||
namespace Behat\Tests\DummyExtension\ServiceContainer; | ||
|
||
use Behat\EnvironmentLoader; | ||
use Behat\Testwork\ServiceContainer\Extension; | ||
use Behat\Testwork\ServiceContainer\ExtensionManager; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; | ||
|
||
/** | ||
* Class DummyExtension. | ||
* | ||
* @package Behat\SoapExtension\ServiceContainer | ||
*/ | ||
class DummyExtension implements Extension | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigKey() | ||
{ | ||
return 'dummy'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function initialize(ExtensionManager $extensionManager) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(ContainerBuilder $container, array $config) | ||
{ | ||
$loader = new EnvironmentLoader($this, $container, $config); | ||
$loader->load(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function configure(ArrayNodeDefinition $builder) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Feature: Check that environment loader scans it properly | ||
Scenario: Try execute steps from couple extensions which are used environment loader | ||
# Try execute step from SoapExtension. | ||
Given I am working with SOAP service WSDL "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" | ||
# Try execute step from DummyExtension. | ||
Given dummy step | ||
# Try execute step from ExampleExtension. | ||
And do nothing | ||
And example step |