|
1
|
|
|
<?php |
|
2
|
|
|
use Ubiquity\controllers\Startup; |
|
3
|
|
|
use tests\unit\controllers\controllers\TestController; |
|
4
|
|
|
|
|
5
|
|
|
require_once 'Ubiquity/controllers/Startup.php'; |
|
6
|
|
|
require_once 'tests/unit/controllers/controllers/TestController.php'; |
|
7
|
|
|
require_once 'tests/unit/controllers/controllers/TestControllerInitialize.php'; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Startup test case. |
|
11
|
|
|
*/ |
|
12
|
|
|
class StartupTest extends \Codeception\Test\Unit { |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* |
|
16
|
|
|
* @var Startup |
|
17
|
|
|
*/ |
|
18
|
|
|
private $startup; |
|
19
|
|
|
private $config; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Prepares the environment before running a test. |
|
23
|
|
|
*/ |
|
24
|
|
|
protected function _before() { |
|
25
|
|
|
$this->config = include 'tests/unit/config/config.php'; |
|
26
|
|
|
include 'tests/unit/config/services.php'; |
|
27
|
|
|
$this->startup = new Startup (); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Cleans up the environment after running a test. |
|
32
|
|
|
*/ |
|
33
|
|
|
protected function _after() { |
|
34
|
|
|
$this->startup = null; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Tests Startup::run() |
|
39
|
|
|
*/ |
|
40
|
|
|
public function testRun() { |
|
41
|
|
|
ob_start (); |
|
42
|
|
|
Startup::run ( $this->config ); |
|
43
|
|
|
$this->assertEquals ( TestController::class, $this->startup->getController () ); |
|
44
|
|
|
$this->assertEquals ( 'index', $this->startup->getAction () ); |
|
45
|
|
|
$this->assertNull ( $this->startup->getActionParams () ); |
|
46
|
|
|
$res = ob_get_clean (); |
|
47
|
|
|
$this->assertEquals ( 'Hello world!', $res ); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Tests Startup::forward() |
|
52
|
|
|
*/ |
|
53
|
|
|
public function testForward() { |
|
54
|
|
|
ob_start (); |
|
55
|
|
|
Startup::forward ( "TestController/doForward" ); |
|
56
|
|
|
$res = ob_get_clean (); |
|
57
|
|
|
$this->assertEquals ( 'forward!', $res ); |
|
58
|
|
|
ob_start (); |
|
59
|
|
|
Startup::forward ( "TestControllerInitialize/doForward" ); |
|
60
|
|
|
$res = ob_get_clean (); |
|
61
|
|
|
$this->assertEquals ( 'initialize!-forward!-finalize!', $res ); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Tests Startup::runAction() |
|
66
|
|
|
*/ |
|
67
|
|
|
public function testRunAction() { |
|
68
|
|
|
// TODO Auto-generated StartupTest::testRunAction() |
|
69
|
|
|
$this->markTestIncomplete ( "runAction test not implemented" ); |
|
70
|
|
|
|
|
71
|
|
|
Startup::runAction(/* parameters */); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Tests Startup::injectDependences() |
|
76
|
|
|
*/ |
|
77
|
|
|
public function testInjectDependences() { |
|
78
|
|
|
// TODO Auto-generated StartupTest::testInjectDependences() |
|
79
|
|
|
$this->markTestIncomplete ( "injectDependences test not implemented" ); |
|
80
|
|
|
|
|
81
|
|
|
Startup::injectDependences(/* parameters */); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Tests Startup::runAsString() |
|
86
|
|
|
*/ |
|
87
|
|
|
public function testRunAsString() { |
|
88
|
|
|
// TODO Auto-generated StartupTest::testRunAsString() |
|
89
|
|
|
$this->markTestIncomplete ( "runAsString test not implemented" ); |
|
90
|
|
|
|
|
91
|
|
|
Startup::runAsString(/* parameters */); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Tests Startup::errorHandler() |
|
96
|
|
|
*/ |
|
97
|
|
|
public function testErrorHandler() { |
|
98
|
|
|
// TODO Auto-generated StartupTest::testErrorHandler() |
|
99
|
|
|
$this->markTestIncomplete ( "errorHandler test not implemented" ); |
|
100
|
|
|
|
|
101
|
|
|
Startup::errorHandler(/* parameters */); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Tests Startup::getController() |
|
106
|
|
|
*/ |
|
107
|
|
|
public function testGetController() { |
|
108
|
|
|
// TODO Auto-generated StartupTest::testGetController() |
|
109
|
|
|
$this->markTestIncomplete ( "getController test not implemented" ); |
|
110
|
|
|
|
|
111
|
|
|
Startup::getController(/* parameters */); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Tests Startup::getControllerSimpleName() |
|
116
|
|
|
*/ |
|
117
|
|
|
public function testGetControllerSimpleName() { |
|
118
|
|
|
// TODO Auto-generated StartupTest::testGetControllerSimpleName() |
|
119
|
|
|
$this->markTestIncomplete ( "getControllerSimpleName test not implemented" ); |
|
120
|
|
|
|
|
121
|
|
|
Startup::getControllerSimpleName(/* parameters */); |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* Tests Startup::getViewNameFileExtension() |
|
126
|
|
|
*/ |
|
127
|
|
|
public function testGetViewNameFileExtension() { |
|
128
|
|
|
// TODO Auto-generated StartupTest::testGetViewNameFileExtension() |
|
129
|
|
|
$this->markTestIncomplete ( "getViewNameFileExtension test not implemented" ); |
|
130
|
|
|
|
|
131
|
|
|
Startup::getViewNameFileExtension(/* parameters */); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* Tests Startup::getAction() |
|
136
|
|
|
*/ |
|
137
|
|
|
public function testGetAction() { |
|
138
|
|
|
// TODO Auto-generated StartupTest::testGetAction() |
|
139
|
|
|
$this->markTestIncomplete ( "getAction test not implemented" ); |
|
140
|
|
|
|
|
141
|
|
|
Startup::getAction(/* parameters */); |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* Tests Startup::getActionParams() |
|
146
|
|
|
*/ |
|
147
|
|
|
public function testGetActionParams() { |
|
148
|
|
|
// TODO Auto-generated StartupTest::testGetActionParams() |
|
149
|
|
|
$this->markTestIncomplete ( "getActionParams test not implemented" ); |
|
150
|
|
|
|
|
151
|
|
|
Startup::getActionParams(/* parameters */); |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* Tests Startup::getFrameworkDir() |
|
156
|
|
|
*/ |
|
157
|
|
|
public function testGetFrameworkDir() { |
|
158
|
|
|
// TODO Auto-generated StartupTest::testGetFrameworkDir() |
|
159
|
|
|
$this->markTestIncomplete ( "getFrameworkDir test not implemented" ); |
|
160
|
|
|
|
|
161
|
|
|
Startup::getFrameworkDir(/* parameters */); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* Tests Startup::getApplicationDir() |
|
166
|
|
|
*/ |
|
167
|
|
|
public function testGetApplicationDir() { |
|
168
|
|
|
// TODO Auto-generated StartupTest::testGetApplicationDir() |
|
169
|
|
|
$this->markTestIncomplete ( "getApplicationDir test not implemented" ); |
|
170
|
|
|
|
|
171
|
|
|
Startup::getApplicationDir(/* parameters */); |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
/** |
|
175
|
|
|
* Tests Startup::getApplicationName() |
|
176
|
|
|
*/ |
|
177
|
|
|
public function testGetApplicationName() { |
|
178
|
|
|
// TODO Auto-generated StartupTest::testGetApplicationName() |
|
179
|
|
|
$this->markTestIncomplete ( "getApplicationName test not implemented" ); |
|
180
|
|
|
|
|
181
|
|
|
Startup::getApplicationName(/* parameters */); |
|
182
|
|
|
} |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
|