KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
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/Hook/Call/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/irtiweb/CATS/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php
<?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\Hook\Call;

use Behat\Behat\Hook\Scope\ScenarioScope;
use Behat\Gherkin\Filter\NameFilter;
use Behat\Gherkin\Filter\TagFilter;
use Behat\Gherkin\Node\FeatureNode;
use Behat\Gherkin\Node\ScenarioInterface;
use Behat\Testwork\Hook\Call\RuntimeFilterableHook;
use Behat\Testwork\Hook\Scope\HookScope;

/**
 * Represents a scenario hook.
 *
 * @author Konstantin Kudryashov <[email protected]>
 */
abstract class RuntimeScenarioHook extends RuntimeFilterableHook
{
    /**
     * {@inheritdoc}
     */
    public function filterMatches(HookScope $scope)
    {
        if (!$scope instanceof ScenarioScope) {
            return false;
        }

        if (null === ($filterString = $this->getFilterString())) {
            return true;
        }

        return $this->isMatch($scope->getFeature(), $scope->getScenario(), $filterString);
    }

    /**
     * Checks if nodes match filter.
     *
     * @param FeatureNode       $feature
     * @param ScenarioInterface $scenario
     * @param string            $filterString
     *
     * @return Boolean
     */
    protected function isMatch(FeatureNode $feature, ScenarioInterface $scenario, $filterString)
    {
        if (false !== strpos($filterString, '@')) {
            return $this->isMatchTagFilter($feature, $scenario, $filterString);
        }

        if (!empty($filterString)) {
            return $this->isMatchNameFilter($scenario, $filterString);
        }

        return false;
    }

    /**
     * Checks if node match tag filter.
     *
     * @param FeatureNode       $feature
     * @param ScenarioInterface $scenario
     * @param string            $filterString
     *
     * @return Boolean
     */
    protected function isMatchTagFilter(FeatureNode $feature, ScenarioInterface $scenario, $filterString)
    {
        $filter = new TagFilter($filterString);

        if ($filter->isFeatureMatch($feature)) {
            return true;
        }

        return $filter->isScenarioMatch($feature, $scenario);
    }

    /**
     * Checks if scenario matches name filter.
     *
     * @param ScenarioInterface $scenario
     * @param string            $filterString
     *
     * @return Boolean
     */
    protected function isMatchNameFilter(ScenarioInterface $scenario, $filterString)
    {
        $filter = new NameFilter($filterString);

        return $filter->isScenarioMatch($scenario);
    }
}

Anon7 - 2021