# wp-optimize/3.2.5/vendor/rosell-dk/htaccess-capability-tester/src/Testers/DirectoryIndexTester.php

WP-Optimize – Cache, Compress images, Minify &amp; Clean database to boost page speed &amp; performance, version 3.2.5. 49 lines.

- Page: https://pluginprobe.com/plugins/wp-optimize/3.2.5/code/vendor/rosell-dk/htaccess-capability-tester/src/Testers/DirectoryIndexTester.php
- Raw: https://pluginprobe.com/plugins/wp-optimize/3.2.5/raw/vendor/rosell-dk/htaccess-capability-tester/src/Testers/DirectoryIndexTester.php
- Modified: 2021-11-30T14:57:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-optimize/3.2.5/code/vendor/rosell-dk/htaccess-capability-tester/src/Testers/DirectoryIndexTester.php#L10-L20`.

```php
<?php

namespace HtaccessCapabilityTester\Testers;

/**
 * Class for testing if DirectoryIndex works
 *
 * @package    HtaccessCapabilityTester
 * @author     Bjørn Rosell <it@rosell.dk>
 * @since      Class available since 0.7
 */
class DirectoryIndexTester extends CustomTester
{

    /**
     * Constructor.
     *
     * @return void
     */
    public function __construct()
    {
        $htaccessFile = <<<'EOD'
<IfModule mod_dir.c>
    DirectoryIndex index2.html
</IfModule>
EOD;

        $test = [
            'subdir' => 'directory-index',
            'files' => [
                ['.htaccess', $htaccessFile],
                ['index.html', "0"],
                ['index2.html', "1"]
            ],
            'request' => [
                'url' => '',    // We request the index, that is why its empty
                'bypass-standard-error-handling' => ['404']
            ],
            'interpretation' => [
                ['success', 'body', 'equals', '1'],
                ['failure', 'body', 'equals', '0'],
                ['failure', 'status-code', 'equals', '404'],  // "index.html" might not be set to index
            ]
        ];

        parent::__construct($test);
    }
}

```
