mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-05-03 16:24:55 +00:00
58 lines
1.5 KiB
PHP
58 lines
1.5 KiB
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Spatie\Permission\PermissionRegistrar;
|
|
use Tests\TestCase;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Test Case
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
pest()->extend(TestCase::class)
|
|
->use(RefreshDatabase::class)
|
|
->beforeEach(function () {
|
|
config()->set('permission.testing', true);
|
|
app()->make(PermissionRegistrar::class)->forgetCachedPermissions();
|
|
})
|
|
->in('Feature', '../resources/views');
|
|
|
|
pest()->extend(TestCase::class)
|
|
->use(RefreshDatabase::class)
|
|
->beforeEach(function () {
|
|
config()->set('database.connections.sqlite.database', database_path('testing.sqlite'));
|
|
config()->set('permission.testing', true);
|
|
})
|
|
->in('Browser');
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Expectations
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
expect()->extend('toBeOne', function () {
|
|
return $this->toBe(1);
|
|
});
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Functions
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
function actingAsUser(array $attributes = []): User
|
|
{
|
|
$user = User::factory()->create($attributes);
|
|
test()->actingAs($user);
|
|
|
|
return $user;
|
|
}
|
|
|
|
function defaultCountrySegment(): string
|
|
{
|
|
return (string) config('app.domain_country', 'de');
|
|
}
|