mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-05-07 20:32:26 +00:00
43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Model;
|
|
|
|
use App\Models\Organization;
|
|
use App\Models\Project;
|
|
use App\Models\Task;
|
|
|
|
class TaskModelTest extends ModelTestAbstract
|
|
{
|
|
public function test_it_belongs_to_a_organization(): void
|
|
{
|
|
// Arrange
|
|
$organization = Organization::factory()->create();
|
|
$task = Task::factory()->forOrganization($organization)->create();
|
|
|
|
// Act
|
|
$task->refresh();
|
|
$organizationRel = $task->organization;
|
|
|
|
// Assert
|
|
$this->assertNotNull($organizationRel);
|
|
$this->assertTrue($organizationRel->is($organization));
|
|
}
|
|
|
|
public function test_it_belongs_to_a_project(): void
|
|
{
|
|
// Arrange
|
|
$project = Project::factory()->create();
|
|
$task = Task::factory()->forProject($project)->create();
|
|
|
|
// Act
|
|
$task->refresh();
|
|
$projectRel = $task->project;
|
|
|
|
// Assert
|
|
$this->assertNotNull($projectRel);
|
|
$this->assertTrue($projectRel->is($project));
|
|
}
|
|
}
|