DrupalListener.php in Drupal 10
File
core/tests/Drupal/Tests/Listeners/DrupalListener.php
View source
<?php
namespace Drupal\Tests\Listeners;
use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\TestListenerDefaultImplementation;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestSuite;
use Symfony\Bridge\PhpUnit\SymfonyTestsListener;
class DrupalListener implements TestListener {
use TestListenerDefaultImplementation;
use DrupalComponentTestListenerTrait;
use DrupalStandardsListenerTrait;
private $symfonyListener;
public function __construct() {
$this->symfonyListener = new SymfonyTestsListener();
}
public function startTestSuite(TestSuite $suite) : void {
$this->symfonyListener
->startTestSuite($suite);
}
public function addSkippedTest(Test $test, \Throwable $t, float $time) : void {
$this->symfonyListener
->addSkippedTest($test, $t, $time);
}
public function startTest(Test $test) : void {
$this->symfonyListener
->startTest($test);
$class = new \ReflectionClass($test);
if ($class
->hasProperty('modules') && !$class
->getProperty('modules')
->isProtected()) {
@trigger_error('The ' . get_class($test) . '::$modules property must be declared protected. See https://www.drupal.org/node/2909426', E_USER_DEPRECATED);
}
}
public function endTest(Test $test, float $time) : void {
$this->symfonyListener
->endTest($test, $time);
$this
->componentEndTest($test, $time);
$this
->standardsEndTest($test, $time);
}
}