Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TestSuiteIterator.php

class TestSuiteIterator

@template-implements RecursiveIterator<int, Test>

@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

@internal This class is not covered by the backward compatibility promise for PHPUnit

Hierarchy

  • class \PHPUnit\Framework\TestSuiteIterator implements \RecursiveIterator

Expanded class hierarchy of TestSuiteIterator

File

vendor/phpunit/phpunit/src/Framework/TestSuiteIterator.php, line 23

Namespace

PHPUnit\Framework
View source
final class TestSuiteIterator implements RecursiveIterator {
    private int $position = 0;
    
    /**
     * @psalm-var list<Test>
     */
    private readonly array $tests;
    public function __construct(TestSuite $testSuite) {
        $this->tests = $testSuite->tests();
    }
    public function rewind() : void {
        $this->position = 0;
    }
    public function valid() : bool {
        return $this->position < count($this->tests);
    }
    public function key() : int {
        return $this->position;
    }
    public function current() : Test {
        return $this->tests[$this->position];
    }
    public function next() : void {
        $this->position++;
    }
    
    /**
     * @throws NoChildTestSuiteException
     */
    public function getChildren() : self {
        if (!$this->hasChildren()) {
            throw new NoChildTestSuiteException('The current item is not a TestSuite instance and therefore does not have any children.');
        }
        $current = $this->current();
        assert($current instanceof TestSuite);
        return new self($current);
    }
    public function hasChildren() : bool {
        return $this->valid() && $this->current() instanceof TestSuite;
    }

}

Members

Title Sort descending Modifiers Object type Summary
TestSuiteIterator::$position private property
TestSuiteIterator::$tests private property @psalm-var list&lt;Test&gt;
TestSuiteIterator::current public function
TestSuiteIterator::getChildren public function
TestSuiteIterator::hasChildren public function
TestSuiteIterator::key public function
TestSuiteIterator::next public function
TestSuiteIterator::rewind public function
TestSuiteIterator::valid public function
TestSuiteIterator::__construct public function
RSS feed
Powered by Drupal