/**
  * {@inheritdoc}
  */
 public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip)
 {
     $event = new BeforeStepTested($env, $feature, $step);
     $this->eventDispatcher->dispatch($event::BEFORE, $event);
     $setup = $this->baseTester->setUp($env, $feature, $step, $skip);
     $event = new AfterStepSetup($env, $feature, $step, $setup);
     $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
     return $setup;
 }
 /**
  * {@inheritdoc}
  */
 public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip)
 {
     $setup = $this->baseTester->setUp($env, $feature, $step, $skip);
     if ($skip) {
         return $setup;
     }
     $scope = new BeforeStepScope($env, $feature, $step);
     $hookCallResults = $this->hookDispatcher->dispatchScopeHooks($scope);
     return new HookedSetup($setup, $hookCallResults);
 }
Beispiel #3
0
 /**
  * @param array $steps
  * @param Suite $suite
  * @return \Behat\Behat\Tester\Result\StepResult
  */
 public function run($steps, Suite $suite)
 {
     $env = $this->environmentManager->buildEnvironment($suite);
     $env = $this->environmentManager->isolateEnvironment($env);
     $dummyFeatureNode = $this->generator->generate($steps);
     $featureNode = $dummyFeatureNode->getFeatureNode();
     foreach ($dummyFeatureNode->getStepNodes() as $stepNode) {
         $this->stepTester->setUp($env, $featureNode, $stepNode, false);
         $result = $this->stepTester->test($env, $featureNode, $stepNode, false);
         $this->stepTester->tearDown($env, $featureNode, $stepNode, false, $result);
     }
     return $result;
 }
 /**
  * Tests container.
  *
  * @param Environment            $env
  * @param FeatureNode            $feature
  * @param StepContainerInterface $container
  * @param Boolean                $skip
  *
  * @return TestResult[]
  */
 public function test(Environment $env, FeatureNode $feature, StepContainerInterface $container, $skip)
 {
     $results = array();
     foreach ($container->getSteps() as $step) {
         $setup = $this->stepTester->setUp($env, $feature, $step, $skip);
         $skipSetup = !$setup->isSuccessful() || $skip;
         $testResult = $this->stepTester->test($env, $feature, $step, $skipSetup);
         $skip = !$testResult->isPassed() || $skip;
         $teardown = $this->stepTester->tearDown($env, $feature, $step, $skipSetup, $testResult);
         $skip = $skip || $skipSetup || !$teardown->isSuccessful();
         $integerResult = new IntegerTestResult($testResult->getResultCode());
         $results[] = new TestWithSetupResult($setup, $integerResult, $teardown);
     }
     return $results;
 }
Beispiel #5
0
 /**
  * {@inheritdoc}
  */
 public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip)
 {
     return $this->baseTester->setUp($env, $feature, $step, $skip);
 }