mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-10 09:12:15 +01:00
Added user and organization deletion system; Added coverage annotations
This commit is contained in:
committed by
Constantin Graf
parent
8857befc6c
commit
86f5ea47bb
@@ -7,8 +7,10 @@ namespace Tests\Unit\Filament;
|
||||
use App\Filament\Resources\OrganizationResource;
|
||||
use App\Models\Organization;
|
||||
use App\Models\User;
|
||||
use App\Service\DeletionService;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Livewire\Livewire;
|
||||
use Mockery\MockInterface;
|
||||
|
||||
class OrganizationResourceTest extends FilamentTestCase
|
||||
{
|
||||
@@ -50,4 +52,23 @@ class OrganizationResourceTest extends FilamentTestCase
|
||||
// Assert
|
||||
$response->assertSuccessful();
|
||||
}
|
||||
|
||||
public function test_can_delete_a_organization(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = $this->createUserWithPermission();
|
||||
$this->mock(DeletionService::class, function (MockInterface $mock) use ($user): void {
|
||||
$mock->shouldReceive('deleteOrganization')
|
||||
->withArgs(fn (Organization $organizationArg) => $organizationArg->is($user->organization))
|
||||
->once();
|
||||
});
|
||||
|
||||
// Act
|
||||
$response = Livewire::test(OrganizationResource\Pages\EditOrganization::class, ['record' => $user->organization->getKey()])
|
||||
->callAction('delete')
|
||||
->assertHasNoActionErrors();
|
||||
|
||||
// Assert
|
||||
$response->assertSuccessful();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user