# wp-optimize/3.2.5/vendor/rosell-dk/file-util/tests/FileExistsTest.php

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

- Page: https://pluginprobe.com/plugins/wp-optimize/3.2.5/code/vendor/rosell-dk/file-util/tests/FileExistsTest.php
- Raw: https://pluginprobe.com/plugins/wp-optimize/3.2.5/raw/vendor/rosell-dk/file-util/tests/FileExistsTest.php
- Modified: 2022-06-03T18:20:18+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/file-util/tests/FileExistsTest.php#L10-L20`.

```php
<?php

namespace FileUtil\Tests;

use PHPUnit\Framework\TestCase;
use FileUtil\FileExists;
use org\bovigo\vfs\vfsStream;

class FileExistsTest extends TestCase
{
    public function testFileExists()
    {
        $this->assertTrue(FileExists::fileExists(__DIR__ . '/FileExistsTest.php'));
        $this->assertFalse(FileExists::fileExists(__DIR__ . '/not-here.php'));
    }

    public function testFileExistsTryHarder()
    {
        if (function_exists('exec')) {
            $this->assertTrue(FileExists::fileExistsTryHarder(__DIR__ . '/FileExistsTest.php'));
            $this->assertFalse(FileExists::fileExistsTryHarder(__DIR__ . '/not-here.php'));
        }
    }


    /*
    public function testFileExistsNoReadPermission()
    {
        $root = vfsStream::setup();
        $file = vfsStream::newFile('hello.txt')
            ->withContent('hello')
            ->at($root)
            ->chmod(0000);

        // fopen should now fail...
        //$this->expectException(\Exception::class);
        $this->assertTrue(FileExists::fileExists($file->url()));
    }
    */
}

```
