X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FHook%2FServiceContainer%2FHookExtension.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FHook%2FServiceContainer%2FHookExtension.php;h=76d4be9bea4ca0ae2ab0c3cb0ea26fa318b78c1d;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/behat/behat/src/Behat/Behat/Hook/ServiceContainer/HookExtension.php b/vendor/behat/behat/src/Behat/Behat/Hook/ServiceContainer/HookExtension.php new file mode 100644 index 000000000..76d4be9be --- /dev/null +++ b/vendor/behat/behat/src/Behat/Behat/Hook/ServiceContainer/HookExtension.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Behat\Behat\Hook\ServiceContainer; + +use Behat\Behat\Context\ServiceContainer\ContextExtension; +use Behat\Behat\Tester\ServiceContainer\TesterExtension; +use Behat\Testwork\Hook\ServiceContainer\HookExtension as BaseExtension; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; + +/** + * Extends Testwork HookExtension with additional behat services. + * + * @author Konstantin Kudryashov + */ +final class HookExtension extends BaseExtension +{ + /** + * {@inheritdoc} + */ + public function load(ContainerBuilder $container, array $config) + { + parent::load($container, $config); + + $this->loadAnnotationReader($container); + } + + /** + * Loads hookable testers. + * + * @param ContainerBuilder $container + */ + protected function loadHookableTesters(ContainerBuilder $container) + { + parent::loadHookableTesters($container); + + $definition = new Definition('Behat\Behat\Hook\Tester\HookableFeatureTester', array( + new Reference(TesterExtension::SPECIFICATION_TESTER_ID), + new Reference(self::DISPATCHER_ID) + )); + $definition->addTag(TesterExtension::SPECIFICATION_TESTER_WRAPPER_TAG, array('priority' => 9999)); + $container->setDefinition(TesterExtension::SPECIFICATION_TESTER_WRAPPER_TAG . '.hookable', $definition); + + $definition = new Definition('Behat\Behat\Hook\Tester\HookableScenarioTester', array( + new Reference(TesterExtension::SCENARIO_TESTER_ID), + new Reference(self::DISPATCHER_ID) + ) + ); + $definition->addTag(TesterExtension::SCENARIO_TESTER_WRAPPER_TAG, array('priority' => 9999)); + $container->setDefinition(TesterExtension::SCENARIO_TESTER_WRAPPER_TAG . '.hookable', $definition); + + $definition = new Definition('Behat\Behat\Hook\Tester\HookableScenarioTester', array( + new Reference(TesterExtension::EXAMPLE_TESTER_ID), + new Reference(self::DISPATCHER_ID) + ) + ); + $definition->addTag(TesterExtension::EXAMPLE_TESTER_WRAPPER_TAG, array('priority' => 9999)); + $container->setDefinition(TesterExtension::EXAMPLE_TESTER_WRAPPER_TAG . '.hookable', $definition); + + $definition = new Definition('Behat\Behat\Hook\Tester\HookableStepTester', array( + new Reference(TesterExtension::STEP_TESTER_ID), + new Reference(self::DISPATCHER_ID) + )); + $definition->addTag(TesterExtension::STEP_TESTER_WRAPPER_TAG, array('priority' => 9999)); + $container->setDefinition(TesterExtension::STEP_TESTER_WRAPPER_TAG . '.hookable', $definition); + } + + /** + * Loads hook annotation reader. + * + * @param ContainerBuilder $container + */ + private function loadAnnotationReader(ContainerBuilder $container) + { + $definition = new Definition('Behat\Behat\Hook\Context\Annotation\HookAnnotationReader'); + $definition->addTag(ContextExtension::ANNOTATION_READER_TAG, array('priority' => 50)); + $container->setDefinition(ContextExtension::ANNOTATION_READER_TAG . '.hook', $definition); + } +}