class DrupalListener

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Listeners/DrupalListener.php \Drupal\Tests\Listeners\DrupalListener
  2. 8.9.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit6/DrupalListener.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit6\DrupalListener
  3. 8.9.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit7/DrupalListener.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit7\DrupalListener
  4. 11.x core/tests/Drupal/Tests/Listeners/DrupalListener.php \Drupal\Tests\Listeners\DrupalListener

Listens to PHPUnit test runs.

@internal

Hierarchy

Expanded class hierarchy of DrupalListener

File

core/tests/Drupal/Tests/Listeners/DrupalListener.php, line 18

Namespace

Drupal\Tests\Listeners
View source
class DrupalListener implements TestListener {
    use TestListenerDefaultImplementation;
    use DrupalComponentTestListenerTrait;
    
    /**
     * The wrapped Symfony test listener.
     *
     * @var \Symfony\Bridge\PhpUnit\SymfonyTestsListener
     */
    private $symfonyListener;
    
    /**
     * Constructs the DrupalListener object.
     */
    public function __construct() {
        $this->symfonyListener = new SymfonyTestsListener();
    }
    
    /**
     * {@inheritdoc}
     */
    public function startTestSuite(TestSuite $suite) : void {
        $this->symfonyListener
            ->startTestSuite($suite);
    }
    
    /**
     * {@inheritdoc}
     */
    public function addSkippedTest(Test $test, \Throwable $t, float $time) : void {
        $this->symfonyListener
            ->addSkippedTest($test, $t, $time);
    }
    
    /**
     * {@inheritdoc}
     */
    public function startTest(Test $test) : void {
        $this->symfonyListener
            ->startTest($test);
    }
    
    /**
     * {@inheritdoc}
     */
    public function endTest(Test $test, float $time) : void {
        $this->symfonyListener
            ->endTest($test, $time);
        $this->componentEndTest($test, $time);
    }

}

Members

Title Sort descending Modifiers Object type Summary
DrupalComponentTestListenerTrait::componentEndTest protected function Reacts to the end of a test.
DrupalListener::$symfonyListener private property The wrapped Symfony test listener.
DrupalListener::addSkippedTest public function
DrupalListener::endTest public function
DrupalListener::startTest public function
DrupalListener::startTestSuite public function
DrupalListener::__construct public function Constructs the DrupalListener object.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.