12 class PhpUnit implements \PHPUnit\Framework\TestListener
33 self::$_defaultEventManager = $eventManager;
45 if (!$this->_eventManager) {
46 throw new \Magento\Framework\Exception\LocalizedException(
__(
'Instance of the event manager is required.'));
55 public function addError(\PHPUnit\Framework\Test $test, \Exception $e, $time)
64 public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, $time)
82 public function addRiskyTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
91 public function addSkippedTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
101 if ($suite instanceof \PHPUnit\Framework\DataProviderTestSuite) {
104 $this->_eventManager->fireEvent(
'startTestSuite');
112 if ($suite instanceof \PHPUnit\Framework\DataProviderTestSuite) {
115 $this->_eventManager->fireEvent(
'endTestSuite', [$suite],
true);
121 public function startTest(\PHPUnit\Framework\Test $test)
123 if (!$test instanceof \PHPUnit\Framework\TestCase || $test instanceof \PHPUnit\Framework\Warning) {
126 $this->_eventManager->fireEvent(
'startTest', [$test]);
133 public function endTest(\PHPUnit\Framework\Test $test, $time)
135 if (!$test instanceof \PHPUnit\Framework\TestCase || $test instanceof \PHPUnit\Framework\Warning) {
138 $this->_eventManager->fireEvent(
'endTest', [$test],
true);
144 public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, $time)
addSkippedTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, $time)
__construct(\Magento\TestFramework\EventManager $eventManager=null)
addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
static $_defaultEventManager
startTestSuite(\PHPUnit\Framework\TestSuite $suite)
startTest(\PHPUnit\Framework\Test $test)
addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, $time)
static setDefaultEventManager(\Magento\TestFramework\EventManager $eventManager=null)
addRiskyTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
endTestSuite(\PHPUnit\Framework\TestSuite $suite)
addError(\PHPUnit\Framework\Test $test, \Exception $e, $time)
endTest(\PHPUnit\Framework\Test $test, $time)