mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-15 01:54:09 -08:00
541350916d
# Conflicts: # tests/Feature/Api/Users/UpdateUserApiTest.php # tests/Feature/Notifications/AccessoryWebhookTest.php # tests/Feature/Notifications/AssetWebhookTest.php # tests/Feature/Notifications/ComponentWebhookTest.php # tests/Feature/Notifications/ConsumableWebhookTest.php # tests/Feature/Notifications/LicenseWebhookTest.php
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests;
|
|
|
|
use App\Http\Middleware\SecurityHeaders;
|
|
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
|
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
|
use RuntimeException;
|
|
use Tests\Support\AssertsAgainstSlackNotifications;
|
|
use Tests\Support\CustomTestMacros;
|
|
use Tests\Support\InteractsWithAuthentication;
|
|
use Tests\Support\InitializesSettings;
|
|
|
|
abstract class TestCase extends BaseTestCase
|
|
{
|
|
use AssertsAgainstSlackNotifications;
|
|
use CreatesApplication;
|
|
use CustomTestMacros;
|
|
use InteractsWithAuthentication;
|
|
use InitializesSettings;
|
|
use LazilyRefreshDatabase;
|
|
|
|
private array $globallyDisabledMiddleware = [
|
|
SecurityHeaders::class,
|
|
];
|
|
|
|
protected function setUp(): void
|
|
{
|
|
$this->guardAgainstMissingEnv();
|
|
|
|
parent::setUp();
|
|
|
|
$this->registerCustomMacros();
|
|
|
|
$this->withoutMiddleware($this->globallyDisabledMiddleware);
|
|
|
|
$this->initializeSettings();
|
|
}
|
|
|
|
private function guardAgainstMissingEnv(): void
|
|
{
|
|
if (!file_exists(realpath(__DIR__ . '/../') . '/.env.testing')) {
|
|
throw new RuntimeException(
|
|
'.env.testing file does not exist. Aborting to avoid wiping your local database.'
|
|
);
|
|
}
|
|
}
|
|
}
|