fedi-feed-router/tests/TestCase.php
myrmidex 6784af2ff6
Some checks failed
CI / ci (push) Failing after 4m31s
25 - Fix all PHPStan errors and add mockery extension
2026-03-08 14:18:28 +01:00

43 lines
1.1 KiB
PHP

<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\Facades\Http;
use Mockery;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
protected function setUp(): void
{
parent::setUp();
// Clean up any existing Mockery instances before each test
if (class_exists(Mockery::class)) {
Mockery::close();
Mockery::globalHelpers();
}
// Prevent any external HTTP requests during tests unless explicitly faked in a test
Http::preventStrayRequests();
}
protected function tearDown(): void
{
// Clear HTTP fakes between tests to prevent interference
Http::clearResolvedInstances();
// Clear all facade instances to prevent interference
Facade::clearResolvedInstances();
// Ensure Mockery is properly closed to prevent facade interference
if (class_exists(Mockery::class)) {
Mockery::close();
}
parent::tearDown();
}
}