nodes are scheduled on different days according to dates provided
This commit is contained in:
parent
858f2e075f
commit
358694e7e3
3 changed files with 58 additions and 2 deletions
|
|
@ -11,6 +11,7 @@ use App\Text\CreateTextDto;
|
|||
use App\User\UseCases\CreateUserDto;
|
||||
use App\User\User;
|
||||
use App\ValueObjects\EmailAddress;
|
||||
use DateTimeImmutable;
|
||||
use DomainException;
|
||||
use Tests\Fakes\FakeNodeRepository;
|
||||
use Tests\Fakes\FakePlanRepository;
|
||||
|
|
@ -230,4 +231,43 @@ class CreatePlanTest extends TestCase
|
|||
dateEnd: '2025-01-01',
|
||||
));
|
||||
}
|
||||
|
||||
public function test_scheduled_nodes_are_scheduled_on_different_days(): void
|
||||
{
|
||||
$text = $this->textRepo->find(0);
|
||||
$rootNode = $this->nodeRepo->create(new CreateNodeDto(
|
||||
text: $text,
|
||||
title: 'root node',
|
||||
parentNode: null,
|
||||
));
|
||||
$this->nodeRepo->create(new CreateNodeDto(
|
||||
text: $text,
|
||||
title: 'child 1',
|
||||
parentNode: $rootNode,
|
||||
));
|
||||
$this->nodeRepo->create(new CreateNodeDto(
|
||||
text: $text,
|
||||
title: 'child 2',
|
||||
parentNode: $rootNode,
|
||||
));
|
||||
$plan = $this->useCase->execute(new CreatePlanRequest(
|
||||
userId: 0,
|
||||
name: 'testPlan',
|
||||
textId: 0,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-02',
|
||||
));
|
||||
$childOne = $this->scheduledNodeRepo->find(0);
|
||||
$childTwo = $this->scheduledNodeRepo->find(1);
|
||||
$this->assertNotNull($childOne);
|
||||
$this->assertNotNull($childTwo);
|
||||
$this->assertEquals(
|
||||
new DateTimeImmutable('2025-01-01'),
|
||||
$childOne->getDate()
|
||||
);
|
||||
$this->assertEquals(
|
||||
new DateTimeImmutable('2025-01-02'),
|
||||
$childTwo->getDate()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue