Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * Unit Tests for the phpDocumentor_setup->decideOnOrOff() method
4
 * @package tests
5
 * @subpackage PhpDocumentorUnitTests
6
 * @author Chuck Burgess
7
 * @since 1.3.2
8
 */
9
 
10
/**
11
 * PHPUnit main() hack
12
 *
13
 * "Call class::main() if this source file is executed directly."
14
 * @since 1.3.2
15
 */
16
if (!defined("PHPUnit_MAIN_METHOD")) {
17
    define("PHPUnit_MAIN_METHOD", "phpDocumentorSetupDecideOnOrOffTests::main");
18
}
19
/**
20
 * TestCase
21
 *
22
 * required by PHPUnit
23
 * @since 1.3.2
24
 */
25
require_once "PHPUnit/Framework/TestCase.php";
26
/**
27
 * TestSuite
28
 *
29
 * required by PHPUnit
30
 * @since 1.3.2
31
 */
32
require_once "PHPUnit/Framework/TestSuite.php";
33
 
34
/**
35
 * Base directory of code
36
 *
37
 * Needed by some of the objects being tested in the suites.
38
 * @since 1.4.1
39
 */
40
chdir(dirname(dirname(__FILE__)));
41
if (!defined("PHPDOCUMENTOR_BASE")) {
42
    define("PHPDOCUMENTOR_BASE", dirname(dirname(__FILE__)));
43
}
44
 
45
/**
46
 * PhpDocumentor Setup
47
 *
48
 * required by PhpDocumentor to instantiate the environment
49
 * @since 1.3.2
50
 */
51
require_once 'PhpDocumentor/phpDocumentor/Setup.inc.php';
52
 
53
/**
54
 * Unit Testing of the phpDocumentor_setup's decideOnOrOff() method
55
 * @package tests
56
 * @subpackage PhpDocumentorUnitTests
57
 * @author Chuck Burgess
58
 * @since 1.3.2
59
 */
60
class tests_phpDocumentorSetupDecideOnOrOffTests extends PHPUnit_Framework_TestCase {
61
 
62
    /**
63
     * phpDocumentor_setup object
64
     * @access private
65
     * @since 1.3.2
66
     */
67
    private $ps;
68
 
69
    /**
70
     * Runs the test methods of this class.
71
     * @access public
72
     * @static
73
     * @since 1.3.2
74
     */
75
    public static function main() {
76
        require_once "PHPUnit/TextUI/TestRunner.php";
77
 
78
        $suite  = new PHPUnit_Framework_TestSuite("tests_phpDocumentorSetupDecideOnOrOffTests");
79
        $result = PHPUnit_TextUI_TestRunner::run($suite);
80
    }
81
 
82
    /**
83
     * Sets up the fixture, for example, open a network connection.
84
     * This method is called before a test is executed.
85
     * @access protected
86
     * @since 1.3.2
87
     */
88
    protected function setUp() {
89
        $GLOBALS['_phpDocumentor_install_dir'] = PHPDOCUMENTOR_BASE;
90
        $GLOBALS['_phpDocumentor_setting']['quiet'] = "true";
91
    }
92
 
93
    /**
94
     * Tears down the fixture, for example, close a network connection.
95
     * This method is called after a test is executed.
96
     * @access protected
97
     * @since 1.3.2
98
     */
99
    protected function tearDown() {
100
        unset($this->ps);
101
    }
102
 
103
 
104
    /**
105
     * NOW LIST THE TEST CASES -------------------------------------------------------|
106
     */
107
 
108
    /**
109
     * normal, expected cases ------------------------------------------|
110
     */
111
 
112
    /**
113
     * demonstrate the correct behavior -----------------------|
114
     */
115
 
116
    /**
117
     * Shows correct behavior for handling the perfect expected "off" value
118
     * @since 1.3.2
119
     */
120
    public function testBasicOff() {
121
        $this->assertFalse(decideOnOrOff('off'));
122
    }
123
    /**
124
     * Shows correct behavior for handling the perfect expected "on" value
125
     * @since 1.3.2
126
     */
127
    public function testBasicOn() {
128
        $this->assertTrue(decideOnOrOff('on'));
129
    }
130
 
131
    /**
132
     * Shows correct behavior for handling the fuzzy "Off" value
133
     * @since 1.3.2
134
     */
135
    public function testFuzzyOffA() {
136
        $this->assertFalse(decideOnOrOff('Off'));
137
    }
138
    /**
139
     * Shows correct behavior for handling the fuzzy "OFF" value
140
     * @since 1.3.2
141
     */
142
    public function testFuzzyOffB() {
143
        $this->assertFalse(decideOnOrOff('OFF'));
144
    }
145
    /**
146
     * Shows correct behavior for handling the fuzzy "no" value
147
     * @since 1.3.2
148
     */
149
    public function testFuzzyNoA() {
150
        $this->assertFalse(decideOnOrOff('no'));
151
    }
152
    /**
153
     * Shows correct behavior for handling the fuzzy "No" value
154
     * @since 1.3.2
155
     */
156
    public function testFuzzyNoB() {
157
        $this->assertFalse(decideOnOrOff('No'));
158
    }
159
    /**
160
     * Shows correct behavior for handling the fuzzy "NO" value
161
     * @since 1.3.2
162
     */
163
    public function testFuzzyNoC() {
164
        $this->assertFalse(decideOnOrOff('NO'));
165
    }
166
    /**
167
     * Shows correct behavior for handling the fuzzy "false" value
168
     * @since 1.3.2
169
     */
170
    public function testFuzzyFalseA() {
171
        $this->assertFalse(decideOnOrOff('false'));
172
    }
173
    /**
174
     * Shows correct behavior for handling the fuzzy "False" value
175
     * @since 1.3.2
176
     */
177
    public function testFuzzyFalseB() {
178
        $this->assertFalse(decideOnOrOff('False'));
179
    }
180
    /**
181
     * Shows correct behavior for handling the fuzzy "FALSE" value
182
     * @since 1.3.2
183
     */
184
    public function testFuzzyFalseC() {
185
        $this->assertFalse(decideOnOrOff('FALSE'));
186
    }
187
    /**
188
     * Shows correct behavior for handling the fuzzy "0" value
189
     * @since 1.3.2
190
     */
191
    public function testFuzzyZero() {
192
        $this->assertFalse(decideOnOrOff(0));
193
    }
194
 
195
    /**
196
     * Shows correct behavior for handling the fuzzy "" value
197
     * @since 1.3.2
198
     */
199
    public function testFuzzyEmpty() {
200
        $this->assertTrue(decideOnOrOff(''));
201
    }
202
    /**
203
     * Shows correct behavior for handling the fuzzy "On" value
204
     * @since 1.3.2
205
     */
206
    public function testFuzzyOnA() {
207
        $this->assertTrue(decideOnOrOff('On'));
208
    }
209
    /**
210
     * Shows correct behavior for handling the fuzzy "ON" value
211
     * @since 1.3.2
212
     */
213
    public function testFuzzyOnB() {
214
        $this->assertTrue(decideOnOrOff('ON'));
215
    }
216
    /**
217
     * Shows correct behavior for handling the fuzzy "y" value
218
     * @since 1.3.2
219
     */
220
    public function testFuzzyYesA() {
221
        $this->assertTrue(decideOnOrOff('y'));
222
    }
223
    /**
224
     * Shows correct behavior for handling the fuzzy "Y" value
225
     * @since 1.3.2
226
     */
227
    public function testFuzzyYesB() {
228
        $this->assertTrue(decideOnOrOff('Y'));
229
    }
230
    /**
231
     * Shows correct behavior for handling the fuzzy "yes" value
232
     * @since 1.3.2
233
     */
234
    public function testFuzzyYesC() {
235
        $this->assertTrue(decideOnOrOff('yes'));
236
    }
237
    /**
238
     * Shows correct behavior for handling the fuzzy "Yes" value
239
     * @since 1.3.2
240
     */
241
    public function testFuzzyYesD() {
242
        $this->assertTrue(decideOnOrOff('Yes'));
243
    }
244
    /**
245
     * Shows correct behavior for handling the fuzzy "YES" value
246
     * @since 1.3.2
247
     */
248
    public function testFuzzyYesE() {
249
        $this->assertTrue(decideOnOrOff('YES'));
250
    }
251
    /**
252
     * Shows correct behavior for handling the fuzzy "true" value
253
     * @since 1.3.2
254
     */
255
    public function testFuzzyTrueA() {
256
        $this->assertTrue(decideOnOrOff('true'));
257
    }
258
    /**
259
     * Shows correct behavior for handling the fuzzy "True" value
260
     * @since 1.3.2
261
     */
262
    public function testFuzzyTrueB() {
263
        $this->assertTrue(decideOnOrOff('True'));
264
    }
265
    /**
266
     * Shows correct behavior for handling the fuzzy "TRUE" value
267
     * @since 1.3.2
268
     */
269
    public function testFuzzyTrueC() {
270
        $this->assertTrue(decideOnOrOff('TRUE'));
271
    }
272
    /**
273
     * Shows correct behavior for handling the fuzzy "1" value
274
     * @since 1.3.2
275
     */
276
    public function testFuzzyOne() {
277
        $this->assertTrue(decideOnOrOff(1));
278
    }
279
 
280
    /**
281
     * END OF "demonstrate the correct behavior" --------------|
282
     */
283
    /**
284
     * END OF "normal, expected cases" ---------------------------------|
285
     */
286
 
287
 
288
    /**
289
     * odd, edge cases -------------------------------------------------|
290
     */
291
 
292
    /**
293
     * Shows correct behavior for handling an odd "  " value
294
     * @since 1.3.2
295
     */
296
    public function testUnexpectedSpaces() {
297
        $this->assertTrue(decideOnOrOff('  '));
298
    }
299
    /**
300
     * Shows correct behavior for handling an odd NULL value
301
     * @since 1.3.2
302
     */
303
    public function testUnexpectedNull() {
304
        $this->assertFalse(decideOnOrOff());
305
    }
306
    /**
307
     * Shows correct behavior for handling an odd "-1" value
308
     * @since 1.3.2
309
     */
310
    public function testUnexpectedNegative() {
311
        $this->assertFalse(decideOnOrOff(-1));
312
    }
313
    /**
314
     * Shows correct behavior for handling an odd "10" value
315
     * @since 1.3.2
316
     */
317
    public function testUnexpectedLargeNumber() {
318
        $this->assertFalse(decideOnOrOff(10));
319
    }
320
    /**
321
     * Shows correct behavior for handling an odd "ash nazg durbatuluk" value
322
     * @since 1.3.2
323
     */
324
    public function testUnexpectedGreatLiterature() {
325
        $this->assertFalse(decideOnOrOff("ash nazg durbatuluk"));
326
    }
327
 
328
    /**
329
     * END OF "odd, edge cases" ----------------------------------------|
330
     */
331
 
332
    /**
333
     * END OF "NOW LIST THE TEST CASES" ----------------------------------------------|
334
     */
335
}
336
 
337
/**
338
 * PHPUnit main() hack
339
 * "Call class::main() if this source file is executed directly."
340
 * @since 1.3.2
341
 */
342
if (PHPUnit_MAIN_METHOD == "phpDocumentorSetupDecideOnOrOffTests::main") {
343
    tests_phpDocumentorSetupDecideOnOrOffTests::main();
344
}
345
?>
346
 
347