fix: laravel preset

This commit is contained in:
Nuno Maduro
2024-07-07 22:46:15 +01:00
parent 1e5b399603
commit 6896dd486a

View File

@ -45,7 +45,10 @@ final class Laravel extends AbstractPreset
$this->expectations[] = expect('App\Models') // @phpstan-ignore-line $this->expectations[] = expect('App\Models') // @phpstan-ignore-line
->classes() ->classes()
->toExtend('Illuminate\Database\Eloquent\Model') ->toExtend('Illuminate\Database\Eloquent\Model');
$this->expectations[] = expect('App\Models') // @phpstan-ignore-line
->classes()
->not->toHaveSuffix('Model'); ->not->toHaveSuffix('Model');
$this->expectations[] = expect('App') $this->expectations[] = expect('App')
@ -54,8 +57,12 @@ final class Laravel extends AbstractPreset
$this->expectations[] = expect('App\Http\Requests') $this->expectations[] = expect('App\Http\Requests')
->classes() ->classes()
->toHaveSuffix('Request') ->toHaveSuffix('Request');
->toExtend('Illuminate\Foundation\Http\FormRequest')
$this->expectations[] = expect('App\Http\Requests')
->toExtend('Illuminate\Foundation\Http\FormRequest');
$this->expectations[] = expect('App\Http\Requests')
->toHaveMethod('rules'); ->toHaveMethod('rules');
$this->expectations[] = expect('App') $this->expectations[] = expect('App')
@ -64,8 +71,14 @@ final class Laravel extends AbstractPreset
$this->expectations[] = expect('App\Console\Commands') $this->expectations[] = expect('App\Console\Commands')
->classes() ->classes()
->toHaveSuffix('Command') ->toHaveSuffix('Command');
->toExtend('Illuminate\Console\Command')
$this->expectations[] = expect('App\Console\Commands')
->classes()
->toExtend('Illuminate\Console\Command');
$this->expectations[] = expect('App\Console\Commands')
->classes()
->toHaveMethod('handle'); ->toHaveMethod('handle');
$this->expectations[] = expect('App') $this->expectations[] = expect('App')
@ -74,7 +87,10 @@ final class Laravel extends AbstractPreset
$this->expectations[] = expect('App\Mail') $this->expectations[] = expect('App\Mail')
->classes() ->classes()
->toExtend('Illuminate\Mail\Mailable') ->toExtend('Illuminate\Mail\Mailable');
$this->expectations[] = expect('App\Mail')
->classes()
->toImplement('Illuminate\Contracts\Queue\ShouldQueue'); ->toImplement('Illuminate\Contracts\Queue\ShouldQueue');
$this->expectations[] = expect('App') $this->expectations[] = expect('App')
@ -83,10 +99,11 @@ final class Laravel extends AbstractPreset
$this->expectations[] = expect('App\Jobs') $this->expectations[] = expect('App\Jobs')
->classes() ->classes()
->toImplement('Illuminate\Contracts\Queue\ShouldQueue') ->toImplement('Illuminate\Contracts\Queue\ShouldQueue');
->toUseTraits([
'Illuminate\Foundation\Queue\Queueable', $this->expectations[] = expect('App\Jobs')
])->toHaveMethod('handle'); ->classes()
->toHaveMethod('handle');
$this->expectations[] = expect('App\Listeners') $this->expectations[] = expect('App\Listeners')
->toHaveMethod('handle'); ->toHaveMethod('handle');
@ -99,12 +116,19 @@ final class Laravel extends AbstractPreset
->ignoring('App\Notifications'); ->ignoring('App\Notifications');
$this->expectations[] = expect('App\Providers') // @phpstan-ignore-line $this->expectations[] = expect('App\Providers') // @phpstan-ignore-line
->toHaveSuffix('ServiceProvider') ->toHaveSuffix('ServiceProvider');
->toExtend('Illuminate\Support\ServiceProvider')
$this->expectations[] = expect('App\Providers') // @phpstan-ignore-line
->toExtend('Illuminate\Support\ServiceProvider');
$this->expectations[] = expect('App\Providers') // @phpstan-ignore-line
->not->toBeUsed(); ->not->toBeUsed();
$this->expectations[] = expect('App') // @phpstan-ignore-line $this->expectations[] = expect('App') // @phpstan-ignore-line
->not->toExtend('Illuminate\Support\ServiceProvider') ->not->toExtend('Illuminate\Support\ServiceProvider')
->ignoring('App\Providers');
$this->expectations[] = expect('App')
->not->toHaveSuffix('ServiceProvider') ->not->toHaveSuffix('ServiceProvider')
->ignoring('App\Providers'); ->ignoring('App\Providers');