/** * Skipped test. * * @param PHPUnit_Framework_Test $test * @param Exception $e * @param float $time * @since Method available since Release 3.0.0 */ public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) { $shouldCreateStartStopEvents = false; if ($test instanceof \PHPUnit_Framework_TestCase) { $methodName = $test->getName(); if ($methodName !== $this->methodName) { $shouldCreateStartStopEvents = true; $this->startTest($test); } } $event = new TestCaseCanceledEvent(); Allure::lifecycle()->fire($event->withException($e)->withMessage($e->getMessage())); if ($shouldCreateStartStopEvents && $test instanceof \PHPUnit_Framework_TestCase) { $this->endTest($test, 0); } }
public function testAddSkippedTest() { $exception = $this->getException(); $time = $this->getTime(); $this->getAllureAdapter()->addSkippedTest($this, $exception, $time); $events = $this->getMockedLifecycle()->getEvents(); $event = new TestCaseCanceledEvent(); $event->withException($exception)->withMessage(EXCEPTION_MESSAGE); $this->assertEquals(3, sizeof($events)); $this->assertInstanceOf('\\Yandex\\Allure\\Adapter\\Event\\TestCaseStartedEvent', $events[0]); $this->assertInstanceOf('\\Yandex\\Allure\\Adapter\\Event\\TestCaseCanceledEvent', $events[1]); $this->assertInstanceOf('\\Yandex\\Allure\\Adapter\\Event\\TestCaseFinishedEvent', $events[2]); $this->assertEquals($event, $events[1]); }
/** * @param FailEvent $failEvent */ public function testSkipped(FailEvent $failEvent) { $event = new TestCaseCanceledEvent(); $e = $failEvent->getFail(); $message = $e->getMessage(); $this->getLifecycle()->fire($event->withException($e)->withMessage($message)); }