X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FTester%2FRuntime%2FRuntimeOutlineTester.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FTester%2FRuntime%2FRuntimeOutlineTester.php;h=1c1c38b2c634fe9ef418ebc080121e8b40974d95;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeOutlineTester.php b/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeOutlineTester.php new file mode 100644 index 000000000..1c1c38b2c --- /dev/null +++ b/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeOutlineTester.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Behat\Behat\Tester\Runtime; + +use Behat\Behat\Tester\OutlineTester; +use Behat\Behat\Tester\ScenarioTester; +use Behat\Gherkin\Node\FeatureNode; +use Behat\Gherkin\Node\OutlineNode; +use Behat\Testwork\Environment\Environment; +use Behat\Testwork\Tester\Result\IntegerTestResult; +use Behat\Testwork\Tester\Result\TestResult; +use Behat\Testwork\Tester\Result\TestResults; +use Behat\Testwork\Tester\Result\TestWithSetupResult; +use Behat\Testwork\Tester\Setup\SuccessfulSetup; +use Behat\Testwork\Tester\Setup\SuccessfulTeardown; + +/** + * Tester executing outline tests in the runtime. + * + * @author Konstantin Kudryashov + */ +final class RuntimeOutlineTester implements OutlineTester +{ + /** + * @var ScenarioTester + */ + private $scenarioTester; + + /** + * Initializes tester. + * + * @param ScenarioTester $scenarioTester + */ + public function __construct(ScenarioTester $scenarioTester) + { + $this->scenarioTester = $scenarioTester; + } + + /** + * {@inheritdoc} + */ + public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip) + { + return new SuccessfulSetup(); + } + + /** + * {@inheritdoc} + */ + public function test(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip = false) + { + $results = array(); + foreach ($outline->getExamples() as $example) { + $setup = $this->scenarioTester->setUp($env, $feature, $example, $skip); + $localSkip = !$setup->isSuccessful() || $skip; + $testResult = $this->scenarioTester->test($env, $feature, $example, $localSkip); + $teardown = $this->scenarioTester->tearDown($env, $feature, $example, $localSkip, $testResult); + + $integerResult = new IntegerTestResult($testResult->getResultCode()); + $results[] = new TestWithSetupResult($setup, $integerResult, $teardown); + } + + return new TestResults($results); + } + + /** + * {@inheritdoc} + */ + public function tearDown(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip, TestResult $result) + { + return new SuccessfulTeardown(); + } +}