Repository navigation
Expand file tree
/
Copy pathTest.php
More file actions
106 lines (90 loc) · 2.36 KB
/
Copy pathTest.php
File metadata and controls
106 lines (90 loc) · 2.36 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
namespace Codeception\TestCase;
use Codeception\CodeceptionEvents;
use Codeception\Event\TestEvent;
use Codeception\Exception\TestRuntime;
use Codeception\Scenario;
use Codeception\SuiteManager;
use Codeception\TestCase;
class Test extends TestCase
{
/**
* @var \Symfony\Component\EventDispatcher\EventDispatcher
*/
protected $dispatcher = null;
protected $bootstrap = null;
/**
* @var \CodeGuy
*/
protected $codeGuy = null;
protected $guyClass;
public function setDispatcher($dispatcher)
{
$this->dispatcher = $dispatcher;
}
public function setBootstrap($bootstrap)
{
$this->bootstrap = $bootstrap;
}
public function setGuyClass($guy)
{
$this->guyClass = $guy;
}
protected function setUp()
{
if ($this->bootstrap) {
require $this->bootstrap;
}
$this->scenario = new Scenario($this);
$guy = $this->guyClass;
if ($guy) {
$property = lcfirst($guy);
$this->codeGuy = $this->$property = new $guy($this->scenario);
}
$this->scenario->run();
$this->fire(CodeceptionEvents::TEST_BEFORE, new TestEvent($this));
$this->_before();
}
/**
* @Override
*/
protected function _before()
{
}
protected function tearDown()
{
$this->_after();
$this->fire(CodeceptionEvents::TEST_AFTER, new TestEvent($this));
}
/**
* @Override
*/
protected function _after()
{
}
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
$this->scenario = new Scenario($this);
}
public function getFeature()
{
$text = $this->getName();
$text = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\\1 \\2', $text);
$text = preg_replace('/([a-z\d])([A-Z])/', '\\1 \\2', $text);
return strtolower($text);
}
/**
* @param $module
*
* @return \Codeception\Module
* @throws \Codeception\Exception\TestRuntime
*/
public function getModule($module)
{
if (SuiteManager::hasModule($module)) {
return SuiteManager::$modules[$module];
}
throw new TestRuntime("Module $module is not enabled for this test suite");
}
}