Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00%
0 / 1
0.00%
0 / 3
CRAP
0.00%
0 / 17
Cest
0.00%
0 / 1
0.00%
0 / 3
56
0.00%
0 / 17
 beforeTest(\Codeception\Event\Test $e)
0.00%
0 / 1
12
0.00%
0 / 5
 afterTest(\Codeception\Event\Test $e)
0.00%
0 / 1
12
0.00%
0 / 5
 getSubscribedEvents()
0.00%
0 / 1
2
0.00%
0 / 7
<?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();
if (method_exists($test->getTestClass(), '_before')) $test->getTestClass()->_before();
}
public function afterTest(\Codeception\Event\Test $e) {
if (!($e->getTest() instanceof \Codeception\TestCase\Cest)) return;
$test = $e->getTest();
if (method_exists($test->getTestClass(), '_after')) $test->getTestClass()->_after();
}
static function getSubscribedEvents()
{
return array(
'test.before' => 'beforeTest',
'test.after' => 'afterTest',
);
}
}