From 8cb4c0a8a2f4344decf58f8d415efc41d6031103 Mon Sep 17 00:00:00 2001 From: Roberto Butti Date: Fri, 19 Apr 2024 23:23:39 +0200 Subject: [PATCH] Welcome Pest PHP and tests --- composer.json | 1 + tests/Data/content/article/article-1.md | 7 +++++++ tests/Feature/CheckModelTest.php | 5 +++++ tests/Pest.php | 3 ++- tests/TestCase.php | 13 +++++++++---- tests/Unit/ExampleTest.php | 9 +++++++++ 6 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 tests/Data/content/article/article-1.md create mode 100644 tests/Feature/CheckModelTest.php diff --git a/composer.json b/composer.json index 0f2c44b..afe9c25 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ "laravel/pint": "^1.13", "orchestra/testbench": "^9.0", "pestphp/pest": "^2.34", + "pestphp/pest-plugin-laravel": "^2.3", "rector/rector": "^1.0" }, "autoload": { diff --git a/tests/Data/content/article/article-1.md b/tests/Data/content/article/article-1.md new file mode 100644 index 0000000..8687f3e --- /dev/null +++ b/tests/Data/content/article/article-1.md @@ -0,0 +1,7 @@ +--- +title: Article Title 1 +--- + +## This is the Article 1 + +Article 1 \ No newline at end of file diff --git a/tests/Feature/CheckModelTest.php b/tests/Feature/CheckModelTest.php new file mode 100644 index 0000000..f99fdfe --- /dev/null +++ b/tests/Feature/CheckModelTest.php @@ -0,0 +1,5 @@ +artisan('fusion:check', ['--dir' => __DIR__.'/../Data/content'])->assertExitCode(0); +}); diff --git a/tests/Pest.php b/tests/Pest.php index 6ae04fc..9990c65 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -11,7 +11,8 @@ | */ -// uses(Tests\TestCase::class)->in('Feature'); +uses(HiFolks\Fusion\Tests\TestCase::class)->in('Feature'); +uses(HiFolks\Fusion\Tests\TestCase::class)->in('Unit'); /* |-------------------------------------------------------------------------- diff --git a/tests/TestCase.php b/tests/TestCase.php index cfb05b6..6d7fa7c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,10 +1,15 @@ toBeTrue(); }); + +test('confirm environment is set to testing', function () { + expect(Config::get('app.env'))->toBe('testing'); + + expect(App::environment())->toBe('testing'); +});