PHP code example of matusstafura / pest-plugin-fileloader

1. Go to this page and download the library: Download matusstafura/pest-plugin-fileloader 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/ */

    

matusstafura / pest-plugin-fileloader example snippets


use function MatusStafura\PestPluginFileLoader\fileLoader;

test('response', function () {
    $json = fileLoader()->json('tests/response_dump.json');
    expect($json)->toBeArray()
        ->and($json['id'])->toBe(1)
        ->and($json['title'])->toBe('Shirt Black');
});

json(string $filepath): array
// $json = fileLoader()->json('response.json');

plaintext(string $filepath): string
// fileLoader()->plaintext('response.txt');

xmlToArray(string $filepath): array
// fileLoader()->json('response.xml');