AfterSymfonyListener.php 942 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
<?php

namespace Drupal\Tests\Listeners;

use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\TestListenerDefaultImplementation;

if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
  class_alias('Drupal\Tests\Listeners\Legacy\AfterSymfonyListener', 'Drupal\Tests\Listeners\AfterSymfonyListener');
  // Using an early return instead of an else does not work when using the
  // PHPUnit phar due to some weird PHP behavior (the class gets defined without
  // executing the code before it and so the definition is not properly
  // conditional).
}
else {
  /**
   * Listens to PHPUnit test runs.
   *
   * @internal
   */
  class AfterSymfonyListener implements TestListener {
    use TestListenerDefaultImplementation;

    /**
     * {@inheritdoc}
     */
    public function endTest(Test $test, $time) {
      restore_error_handler();
    }

  }
}