Skip to content

Commit

Permalink
Welcome Pest PHP and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-butti committed Apr 19, 2024
1 parent 6a194d7 commit 8cb4c0a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 7 additions & 0 deletions tests/Data/content/article/article-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Article Title 1
---

## This is the Article 1

Article 1
5 changes: 5 additions & 0 deletions tests/Feature/CheckModelTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

test('console command', function () {
$this->artisan('fusion:check', ['--dir' => __DIR__.'/../Data/content'])->assertExitCode(0);
});
3 changes: 2 additions & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/*
|--------------------------------------------------------------------------
Expand Down
13 changes: 9 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php

namespace Tests;
namespace HiFolks\Fusion\Tests;

use PHPUnit\Framework\TestCase as BaseTestCase;
use HiFolks\Fusion\FusionServiceProvider;

abstract class TestCase extends BaseTestCase
abstract class TestCase extends \Orchestra\Testbench\TestCase
{
//
protected function getPackageProviders($app)
{
return [
FusionServiceProvider::class,
];
}
}
9 changes: 9 additions & 0 deletions tests/Unit/ExampleTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;

test('example', function (): void {
expect(true)->toBeTrue();
});

test('confirm environment is set to testing', function () {
expect(Config::get('app.env'))->toBe('testing');

expect(App::environment())->toBe('testing');
});

0 comments on commit 8cb4c0a

Please sign in to comment.