ldc-cocotte/tests/Pest.php

61 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2026-06-14 21:32:07 +02:00
<?php
declare(strict_types=1);
use Carbon\Carbon;
use Carbon\CarbonImmutable;
2026-06-14 21:32:07 +02:00
use DG\BypassFinals;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Date;
2026-06-14 21:32:07 +02:00
use Illuminate\Support\Facades\Http;
use PHPUnit\Framework\TestCase as BasePHPUnitTestCase;
use Tests\TestCase as LaravelTestCase;
BypassFinals::enable(bypassReadOnly: false, bypassFinal: true);
BypassFinals::denyPaths([
'*/app/Cqs/Actions/*',
2026-06-14 21:32:07 +02:00
'*/app/Dto/*',
'*/app/Cqs/Queries/*',
2026-06-14 21:32:07 +02:00
'*/domain/Models/*',
'*/shared/DDD/*',
]);
pest()
->extend(LaravelTestCase::class)
->use(RefreshDatabase::class)
->beforeEach(function (): void {
Http::preventStrayRequests();
})
->afterEach(function (): void {
Carbon::setTestNow();
CarbonImmutable::setTestNow();
Date::setTestNow();
})
2026-06-14 21:32:07 +02:00
->in('Feature');
pest()
->extend(LaravelTestCase::class)
->use(RefreshDatabase::class)
->afterEach(function (): void {
Carbon::setTestNow();
CarbonImmutable::setTestNow();
Date::setTestNow();
})
2026-06-14 21:32:07 +02:00
->in('Integration/WithApp');
pest()
->extend(BasePHPUnitTestCase::class)
->afterEach(function (): void {
Carbon::setTestNow();
CarbonImmutable::setTestNow();
})
2026-06-14 21:32:07 +02:00
->in('Integration/Standalones');
pest()
->extend(BasePHPUnitTestCase::class)
->afterEach(function (): void {
Carbon::setTestNow();
CarbonImmutable::setTestNow();
})
2026-06-14 21:32:07 +02:00
->in('Unit');