Repository navigation
Expand file tree
/
Copy pathCest.php
More file actions
53 lines (47 loc) · 1.42 KB
/
Copy pathCest.php
File metadata and controls
53 lines (47 loc) · 1.42 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace Codeception\Subscriber;
use Codeception\CodeceptionEvents;
use Codeception\Event\FailEvent;
use Codeception\Event\TestEvent;
use \Symfony\Component\EventDispatcher\EventSubscriberInterface;
class Cest implements EventSubscriberInterface
{
public function beforeTest(TestEvent $e)
{
if (! ($e->getTest() instanceof \Codeception\TestCase\Cest)) {
return;
}
$test = $e->getTest();
if (method_exists($test->getTestClass(), '_before')) {
$test->getTestClass()->_before($e);
}
}
public function afterTest(TestEvent $e)
{
if (! ($e->getTest() instanceof \Codeception\TestCase\Cest)) {
return;
}
$test = $e->getTest();
if (method_exists($test->getTestClass(), '_after')) {
$test->getTestClass()->_after($e);
}
}
public function failedTest(FailEvent $e)
{
if (! ($e->getTest() instanceof \Codeception\TestCase\Cest)) {
return;
}
$test = $e->getTest();
if (method_exists($test->getTestClass(), '_failed')) {
$test->getTestClass()->_failed($e);
}
}
static function getSubscribedEvents()
{
return array(
CodeceptionEvents::TEST_BEFORE => 'beforeTest',
CodeceptionEvents::TEST_AFTER => 'afterTest',
CodeceptionEvents::TEST_FAIL => 'failedTest'
);
}
}