PHP code example of soyhuce / pest-plugin-laravel

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

    

soyhuce / pest-plugin-laravel example snippets


expect($model)->toBeModel($expectedModel)

expect($collection)->toBeCollection(new Collection([1,2,3]));
/// Expected collection can be given as array
expect($collection)->toBeCollection([1,2,3]);

expect($collection)->toBeCollectionCanonicalizing(new Collection([1,2,3]));
/// Expected collection can be given as array
expect($collection)->toBeCollectionCanonicalizing([3,1,2]);

expect($user)->toBeAbleTo('update', $post);

expect($data)->toBeData(new UserData(['name' => 'John Doe']));

expect($dataCollection)->toBeDataCollection(new UserDataCollection([
    new UserData(['name' => 'John Doe']),
    new UserData(['name' => 'Jane Doe']),
]));

// Expected collection can be given as array
expect($dataCollection)->toBeDataCollection([['name' => 'John Doe'], ['name' => 'Jane Doe']]);