mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 08:12:17 +01:00
Added client and organization endpoints
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user