Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 26 |
Cest | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
110 | |
0.00% |
0 / 26 |
beforeTest(\Codeception\Event\Test $e) | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 6 |
|||
afterTest(\Codeception\Event\Test $e) | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 6 |
|||
failedTest(\Codeception\Event\Fail $e) | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 6 |
|||
getSubscribedEvents() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 8 |
<?php | |
namespace Codeception\Subscriber; | |
use \Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
class Cest implements EventSubscriberInterface | |
{ | |
public function beforeTest(\Codeception\Event\Test $e) { | |
if (!($e->getTest() instanceof \Codeception\TestCase\Cest)) return; | |
$test = $e->getTest(); | |
$scenario = $e->getTest()->getScenario(); | |
if (method_exists($test->getTestClass(), '_before')) $test->getTestClass()->_before($e); | |
} | |
public function afterTest(\Codeception\Event\Test $e) { | |
if (!($e->getTest() instanceof \Codeception\TestCase\Cest)) return; | |
$test = $e->getTest(); | |
$scenario = $e->getTest()->getScenario(); | |
if (method_exists($test->getTestClass(), '_after')) $test->getTestClass()->_after($e); | |
} | |
public function failedTest(\Codeception\Event\Fail $e) { | |
if (!($e->getTest() instanceof \Codeception\TestCase\Cest)) return; | |
$test = $e->getTest(); | |
$scenario = $e->getTest()->getScenario(); | |
if (method_exists($test->getTestClass(), '_failed')) $test->getTestClass()->_failed($e); | |
} | |
static function getSubscribedEvents() | |
{ | |
return array( | |
'test.before' => 'beforeTest', | |
'test.after' => 'afterTest', | |
'test.fail' => 'failedTest' | |
); | |
} | |
} |