Skip to content

Instantly share code, notes, and snippets.

@nasrulhazim
Created August 14, 2024 01:19
Show Gist options
  • Save nasrulhazim/1d2404cec8493beb1c363ed54c6024a1 to your computer and use it in GitHub Desktop.
Save nasrulhazim/1d2404cec8493beb1c363ed54c6024a1 to your computer and use it in GitHub Desktop.
Minimal Architecture Test using PestPHP
<?php
use App\Contracts\Builder;
use App\Contracts\Menu;
it('runs on PHP 8.3 or above')
->expect(phpversion())
->toBeGreaterThanOrEqual('8.3.0');
it('does not use debugging functions')
->expect(['dd', 'dump', 'ray', 'var_dump', 'var_export'])
->not
->toBeUsed();
it('does not using url method')
->expect(['url'])
->not
->toBeUsed();
test('controllers')
->expect('App\Http\Controllers')
->toHaveSuffix('Controller');
test('actions builder')
->expect('App\Actions\Builder')
->toImplement([Builder::class, Menu::class]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment