X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FTestwork%2FTester%2FRuntime%2FRuntimeSuiteTester.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FTestwork%2FTester%2FRuntime%2FRuntimeSuiteTester.php;h=b67838d289c8a1fc6e4e34036dcb57624711f6fa;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hp=0000000000000000000000000000000000000000;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68;p=yaffs-website diff --git a/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php b/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php new file mode 100644 index 000000000..b67838d28 --- /dev/null +++ b/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Behat\Testwork\Tester\Runtime; + +use Behat\Testwork\Environment\Environment; +use Behat\Testwork\Specification\SpecificationIterator; +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; +use Behat\Testwork\Tester\SpecificationTester; +use Behat\Testwork\Tester\SuiteTester; + +/** + * Tester executing suite tests in the runtime. + * + * @author Konstantin Kudryashov + */ +final class RuntimeSuiteTester implements SuiteTester +{ + /** + * @var SpecificationTester + */ + private $specTester; + + /** + * Initializes tester. + * + * @param SpecificationTester $specTester + */ + public function __construct(SpecificationTester $specTester) + { + $this->specTester = $specTester; + } + + /** + * {@inheritdoc} + */ + public function setUp(Environment $env, SpecificationIterator $iterator, $skip) + { + return new SuccessfulSetup(); + } + + /** + * {@inheritdoc} + */ + public function test(Environment $env, SpecificationIterator $iterator, $skip = false) + { + $results = array(); + foreach ($iterator as $specification) { + $setup = $this->specTester->setUp($env, $specification, $skip); + $localSkip = !$setup->isSuccessful() || $skip; + $testResult = $this->specTester->test($env, $specification, $localSkip); + $teardown = $this->specTester->tearDown($env, $specification, $localSkip, $testResult); + + $integerResult = new IntegerTestResult($testResult->getResultCode()); + $results[] = new TestWithSetupResult($setup, $integerResult, $teardown); + } + + return new TestResults($results); + } + + /** + * {@inheritdoc} + */ + public function tearDown(Environment $env, SpecificationIterator $iterator, $skip, TestResult $result) + { + return new SuccessfulTeardown(); + } +}