Skip to content

Commit

Permalink
test(TestCase.php): Add Mockery integration
Browse files Browse the repository at this point in the history
- Added use of MockeryPHPUnitIntegration trait
- Added tearDown method to close Mockery
  • Loading branch information
guanguans committed Aug 30, 2023
1 parent d02adbc commit 20dd278
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"guanguans/ai-commit": "^1.8",
"guanguans/monorepo-builder-worker": "^1.2",
"itsgoingd/clockwork": "^5.1",
"jetbrains/phpstorm-attributes": "^1.0",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.13",
"laravel/legacy-factories": "^1.3",
"laravel/lumen-framework": "^7.0 || ^8.0 || ^9.0 || ^10.0",
Expand All @@ -74,7 +73,6 @@
"rector/rector": "^0.18",
"spatie/pest-plugin-snapshots": "^1.1 || ^2.0",
"spatie/ray": "^1.37",
"veewee/composer-run-parallel": "^1.2",
"vimeo/psalm": "^5.15"
},
"suggest": {
Expand Down Expand Up @@ -102,7 +100,6 @@
"allow-plugins": {
"pestphp/pest-plugin": true,
"phpstan/extension-installer": true,
"veewee/composer-run-parallel": true,
"ergebnis/composer-normalize": true
},
"apcu-autoloader": true,
Expand Down
9 changes: 9 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use phpmock\phpunit\PHPMock;
use Spatie\Snapshots\MatchesSnapshots;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
Expand All @@ -40,6 +41,7 @@
abstract class TestCase extends \Orchestra\Testbench\TestCase
{
use MatchesSnapshots;
use MockeryPHPUnitIntegration;
use PHPMock;
use VarDumperTestTrait;

Expand All @@ -60,11 +62,18 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
protected function setUp(): void
{
parent::setUp();
$this->startMockery();
$this->setUpDatabase();
$this->withFactories(__DIR__.'/Factories/');
$this->seed(UserSeeder::class);
}

protected function tearDown(): void
{
$this->closeMockery();
parent::tearDown();
}

/**
* @param array<class-string, array<string, mixed>>|array<class-string>|class-string $outputs
*/
Expand Down

0 comments on commit 20dd278

Please sign in to comment.