-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored extension namespacing and added support for BEHAT_SCREENSH…
…OT_DIR variable. * Updated config requirements. * Refactored extension classes to use simplified loading. * Added dist behat config. * Added support for BEHAT_SCREENSHOT_DIR env variable.
- Loading branch information
1 parent
4714bd2
commit 5af005a
Showing
10 changed files
with
126 additions
and
108 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
default: | ||
suites: | ||
default: | ||
contexts: | ||
- FeatureContext | ||
- IntegratedExperts\BehatScreenshotExtension\Context\ScreenshotContext | ||
extensions: | ||
IntegratedExperts\BehatScreenshotExtension: | ||
dir: %paths.base%/screenshots | ||
fail: true | ||
purge: false |
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
83 changes: 0 additions & 83 deletions
83
src/IntegratedExperts/Behat/Screenshot/ScreenshotExtension.php
This file was deleted.
Oops, something went wrong.
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
74 changes: 74 additions & 0 deletions
74
src/IntegratedExperts/BehatScreenshotExtension/ServiceContainer/BehatScreenshotExtension.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,74 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Behat screenshot extension. | ||
*/ | ||
|
||
namespace IntegratedExperts\BehatScreenshotExtension\ServiceContainer; | ||
|
||
use Behat\Behat\Context\ServiceContainer\ContextExtension; | ||
use Behat\Testwork\ServiceContainer\Extension as ExtensionInterface; | ||
use Behat\Testwork\ServiceContainer\ExtensionManager; | ||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Definition; | ||
|
||
/** | ||
* Class ScreenshotExtension | ||
*/ | ||
class BehatScreenshotExtension implements ExtensionInterface | ||
{ | ||
|
||
/** | ||
* Extension configuration ID. | ||
*/ | ||
const MOD_ID = 'integratedexperts_screenshot'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigKey() | ||
{ | ||
return self::MOD_ID; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function initialize(ExtensionManager $extensionManager) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function configure(ArrayNodeDefinition $builder) | ||
{ | ||
$builder->children() | ||
->scalarNode('dir')->isRequired()->cannotBeEmpty()->end() | ||
->scalarNode('fail')->isRequired()->cannotBeEmpty()->end() | ||
->scalarNode('purge')->isRequired()->cannotBeEmpty()->end(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(ContainerBuilder $container, array $config) | ||
{ | ||
$definition = new Definition('IntegratedExperts\BehatScreenshotExtension\Context\Initializer\ScreenshotContextInitializer', [ | ||
$config['dir'], | ||
$config['fail'], | ||
$config['purge'], | ||
]); | ||
$definition->addTag(ContextExtension::INITIALIZER_TAG, ['priority' => 0]); | ||
$container->setDefinition('integratedexperts_screenshot.screenshot_context_initializer', $definition); | ||
} | ||
} |