|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/irtiweb/CATS/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/ |
Upload File : |
<?php
/*
* This file is part of the Behat.
* (c) Konstantin Kudryashov <[email protected]>
*
* 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\BackgroundTester;
use Behat\Behat\Tester\Exception\FeatureHasNoBackgroundException;
use Behat\Behat\Tester\StepContainerTester;
use Behat\Gherkin\Node\FeatureNode;
use Behat\Testwork\Environment\Environment;
use Behat\Testwork\Tester\Result\TestResult;
use Behat\Testwork\Tester\Result\TestResults;
use Behat\Testwork\Tester\Setup\SuccessfulSetup;
use Behat\Testwork\Tester\Setup\SuccessfulTeardown;
/**
* Tester executing background tests in the runtime.
*
* @author Konstantin Kudryashov <[email protected]>
*/
final class RuntimeBackgroundTester implements BackgroundTester
{
/**
* @var StepContainerTester
*/
private $containerTester;
/**
* Initializes tester.
*
* @param StepContainerTester $containerTester
*/
public function __construct(StepContainerTester $containerTester)
{
$this->containerTester = $containerTester;
}
/**
* {@inheritdoc}
*/
public function setUp(Environment $env, FeatureNode $feature, $skip)
{
return new SuccessfulSetup();
}
/**
* {@inheritdoc}
*/
public function test(Environment $env, FeatureNode $feature, $skip)
{
$background = $feature->getBackground();
if (null === $background) {
throw new FeatureHasNoBackgroundException(sprintf(
'Feature `%s` has no background that could be tested.',
$feature->getFile()
), $feature);
}
$results = $this->containerTester->test($env, $feature, $background, $skip);
return new TestResults($results);
}
/**
* {@inheritdoc}
*/
public function tearDown(Environment $env, FeatureNode $feature, $skip, TestResult $result)
{
return new SuccessfulTeardown();
}
}