PHP code example of giacomomasseron / filo

1. Go to this page and download the library: Download giacomomasseron/filo 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/ */

    

giacomomasseron / filo example snippets


expect(fn () => $repo->paginateByUser($user))->toRunUnder(10);          // ms
expect(fn () => $service->list())->toCall('App\Repo::find')->atMost(1);  // N+1 guard
// NB: toCall() alone asserts nothing — always finish with atMost()/atLeast()/times().
expect(fn () => $service->list())->toCallOnce('App\Repo::find');
expect(fn () => $service->list())->toNotCall('App\Mail\*');            // trailing * = prefix glob

$this->assertRunsUnder(10, fn () => $repo->paginateByUser($user));
$this->assertCallCount('App\Repo::find', atMost: 1, callable: fn () => $service->list());
$this->assertNoCalls('App\Mail\*', fn () => $service->list());

// tests/Pest.php
uses(Filo\Testing\EnforcesThreshold::class)->in('Feature', 'Unit');

// or PHPUnit: your base TestCase
abstract class TestCase extends BaseTestCase
{
    use Filo\Testing\EnforcesThreshold;
}

$this->threshold(2000);  // this test may take up to 2 s
$this->threshold(null);  // no limit for this test