From 716d17ba4e6dfb59bbafa0c10b7df0e87be5e871 Mon Sep 17 00:00:00 2001 From: guanguans Date: Tue, 10 Sep 2024 21:34:41 +0800 Subject: [PATCH] test(ArchTest): remove skip from arch test - Removed the skip method from the arch test to ensure it runs. - Updated the Pest test setup to clean up specific PHP files before tests run. - Added a file creation step for helpers.php to ensure necessary files are present. --- tests/Feature/ArchTest.php | 12 ++++++++---- tests/Pest.php | 13 ++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tests/Feature/ArchTest.php b/tests/Feature/ArchTest.php index a37777bdbb8..6545c19126d 100644 --- a/tests/Feature/ArchTest.php +++ b/tests/Feature/ArchTest.php @@ -1,5 +1,6 @@ preset()->php(); -// arch()->preset()->security(); -// arch()->preset()->strict(); +arch()->preset()->php(); +arch()->preset()->security(); +arch()->preset()->strict()->ignoring([ + App\Commands\Command::class, + App\Commands\FeedCommand::class, +]); // arch()->preset()->relaxed(); arch('will not use debugging functions') ->group(__DIR__, __FILE__) - ->skip() + // ->skip() ->expect([ 'echo', 'print', diff --git a/tests/Pest.php b/tests/Pest.php index 63529960ad4..9defe358519 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -19,7 +19,18 @@ use Pest\Expectation; uses(Tests\TestCase::class) - ->beforeAll(function (): void {}) + ->beforeAll(function (): void { + foreach ( + Symfony\Component\Finder\Finder::create() + ->in(__DIR__.'/../vendor/guanguans/ai-commit/app') + ->notName('helpers.php') + ->name('*.php') as $splFileInfo + ) { + unlink($splFileInfo->getPathname()); + } + + file_put_contents(__DIR__.'/../vendor/guanguans/ai-commit/app/Support/helpers.php', 'beforeEach(function (): void {}) ->afterEach(function (): void {}) ->afterAll(function (): void {