PHP code example of expect / expect-filesystem

1. Go to this page and download the library: Download expect/expect-filesystem library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

expect / expect-filesystem example snippets


use expect\Expect;
use expect\configurator\FileConfigurator;

$configurator = new FileConfigurator(__DIR__ . '/.expect.toml');
Expect::configure($configurator);

Expect::that('log.txt')->toBeExists(); //pass
Expect::that('not_found_log.txt')->toBeExists(); //failed

Expect::that($file)->toBeExists();

Expect::that($file)->toBeReadable();

Expect::that($file)->toBeWritable();

Expect::that($file)->toBeExecutable();

Expect::that($file)->toBeDirectory();

Expect::that($file)->toBeFile();

Expect::that($file)->toBeMode(644);