cafaa2292b373e50f74fd41ec2bb1f70b1ed8a8e
[yaffs-website] / web / core / tests / Drupal / Tests / Listeners / DrupalListener.php
1 <?php
2
3 namespace Drupal\Tests\Listeners;
4
5 use PHPUnit\Framework\BaseTestListener;
6 use PHPUnit\Framework\Test;
7
8 if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
9   class_alias('Drupal\Tests\Listeners\Legacy\DrupalListener', 'Drupal\Tests\Listeners\DrupalListener');
10   // Using an early return instead of a else does not work when using the
11   // PHPUnit phar due to some weird PHP behavior (the class gets defined without
12   // executing the code before it and so the definition is not properly
13   // conditional).
14 }
15 else {
16   /**
17    * Listens to PHPUnit test runs.
18    *
19    * @internal
20    */
21   class DrupalListener extends BaseTestListener {
22     use DeprecationListenerTrait;
23     use DrupalComponentTestListenerTrait;
24     use DrupalStandardsListenerTrait;
25
26     /**
27      * {@inheritdoc}
28      */
29     public function startTest(Test $test) {
30       $this->deprecationStartTest($test);
31     }
32
33     /**
34      * {@inheritdoc}
35      */
36     public function endTest(Test $test, $time) {
37       $this->deprecationEndTest($test, $time);
38       $this->componentEndTest($test, $time);
39       $this->standardsEndTest($test, $time);
40     }
41
42   }
43 }