Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
20 / 20 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
DirectoryIndexTester | |
100.00% |
20 / 20 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
20 / 20 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace HtaccessCapabilityTester\Testers; |
4 | |
5 | /** |
6 | * Class for testing if DirectoryIndex works |
7 | * |
8 | * @package HtaccessCapabilityTester |
9 | * @author Bjørn Rosell <it@rosell.dk> |
10 | * @since Class available since 0.7 |
11 | */ |
12 | class DirectoryIndexTester extends CustomTester |
13 | { |
14 | |
15 | /** |
16 | * Constructor. |
17 | * |
18 | * @return void |
19 | */ |
20 | public function __construct() |
21 | { |
22 | $htaccessFile = <<<'EOD' |
23 | <IfModule mod_dir.c> |
24 | DirectoryIndex index2.html |
25 | </IfModule> |
26 | EOD; |
27 | |
28 | $test = [ |
29 | 'subdir' => 'directory-index', |
30 | 'files' => [ |
31 | ['.htaccess', $htaccessFile], |
32 | ['index.html', "0"], |
33 | ['index2.html', "1"] |
34 | ], |
35 | 'request' => [ |
36 | 'url' => '', // We request the index, that is why its empty |
37 | 'bypass-standard-error-handling' => ['404'] |
38 | ], |
39 | 'interpretation' => [ |
40 | ['success', 'body', 'equals', '1'], |
41 | ['failure', 'body', 'equals', '0'], |
42 | ['failure', 'status-code', 'equals', '404'], // "index.html" might not be set to index |
43 | ] |
44 | ]; |
45 | |
46 | parent::__construct($test); |
47 | } |
48 | } |