Fixed permissions; Added tests for permission store

This commit is contained in:
Constantin Graf
2024-04-24 15:07:39 +02:00
committed by Constantin Graf
parent 75a3404f46
commit 267adf52ca
6 changed files with 170 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Tests;
use App\Service\PermissionStore;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\Mail;
@@ -20,6 +21,13 @@ abstract class TestCase extends BaseTestCase
LogFake::bind();
}
protected function tearDown(): void
{
// Note: It is necessary to clear the permission cache after each test, since the "scoped singletons" are not reset between tests.
app(PermissionStore::class)->clear();
parent::tearDown();
}
protected function assertEqualsIdsOfEloquentCollection(array $ids, Collection $models): void
{
$this->assertEqualsCanonicalizing($ids, $models->pluck('id')->toArray());