DirectoryIndexTester   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 20
c 1
b 0
f 0
dl 0
loc 35
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 27 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 <[email protected]>
10
 * @since      Class available since 0.7
11
 */
12
class DirectoryIndexTester extends CustomTester
13
{
14
15
    /**
16
     * Constructor.
17
     *
18
     * @return void
19
     */
20 20
    public function __construct()
21
    {
22
        $htaccessFile = <<<'EOD'
23 20
<IfModule mod_dir.c>
24
    DirectoryIndex index2.html
25
</IfModule>
26
EOD;
27
28
        $test = [
29 20
            'subdir' => 'directory-index',
30
            'files' => [
31 20
                ['.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 20
        parent::__construct($test);
47 20
    }
48
}
49