Added client and organization endpoints

This commit is contained in:
Constantin Graf
2024-03-01 16:34:26 +01:00
parent a86e72f655
commit e8912650c0
18 changed files with 679 additions and 17 deletions

View File

@@ -6,6 +6,7 @@ namespace Tests\Unit\Model;
use App\Models\Client;
use App\Models\Organization;
use App\Models\Project;
class ClientModelTest extends ModelTestAbstract
{
@@ -23,4 +24,22 @@ class ClientModelTest extends ModelTestAbstract
$this->assertNotNull($organizationRel);
$this->assertTrue($organizationRel->is($organization));
}
public function test_it_has_many_projects(): void
{
// Arrange
$client = Client::factory()->create();
$otherClient = Client::factory()->create();
$projects = Project::factory()->forClient($client)->createMany(4);
$projectsOtherClient = Project::factory()->forClient($otherClient)->createMany(4);
// Act
$client->refresh();
$projectsRel = $client->projects;
// Assert
$this->assertNotNull($projectsRel);
$this->assertCount(4, $projectsRel);
$this->assertTrue($projectsRel->first()->is($projects->first()));
}
}