HEX
Server: LiteSpeed
System: Linux premium260.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: aliazzsr (627)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/aliazzsr/api.crm.vqode.com/vendor/codeception/phpunit-wrapper/src/FilterTest.php
<?php
namespace Codeception\PHPUnit;

use Codeception\Test\Descriptor;

/**
 * Extended Filter Test from PHPUnit to use Codeception's Descriptor to locate tests.
 *
 * Class FilterTest
 * @package Codeception\PHPUnit
 */
class FilterTest extends \PHPUnit\Runner\Filter\NameFilterIterator
{
    public function accept():bool
    {
        $test = $this->getInnerIterator()->current();

        if ($test instanceof \PHPUnit\Framework\TestSuite) {
            return true;
        }

        $name = Descriptor::getTestSignature($test);
        $index = Descriptor::getTestDataSetIndex($test);

        if (!is_null($index)) {
            $name .= " with data set #{$index}";
        }

        $accepted = preg_match($this->filter, $name, $matches);

        // This fix the issue when an invalid dataprovider method generate a warning
        // See issue https://github.com/Codeception/Codeception/issues/4888
        if($test instanceof \PHPUnit\Framework\WarningTestCase) {
            $message = $test->getMessage();
            $accepted = preg_match($this->filter, $message, $matches);
        }

        if ($accepted && isset($this->filterMax)) {
            $set = end($matches);
            $accepted = $set >= $this->filterMin && $set <= $this->filterMax;
        }
        return $accepted;
    }
}