test scope schedule to requesting user
This commit is contained in:
parent
3711840669
commit
2eafe67f31
1 changed files with 35 additions and 0 deletions
|
|
@ -184,4 +184,39 @@ class GetTodaysScheduleTest extends TestCase
|
|||
|
||||
$this->assertEquals(1, count($result));
|
||||
}
|
||||
|
||||
public function test_does_not_return_other_users_scheduled_nodes(): void
|
||||
{
|
||||
$otherUser = $this->userRepo->create(new CreateUserDto(
|
||||
email: new EmailAddress('other@email.com'),
|
||||
passwordHash: 'hash',
|
||||
isAdmin: false,
|
||||
));
|
||||
$otherPlan = $this->planRepo->create(new CreatePlanDto(
|
||||
name: 'other plan',
|
||||
user: $otherUser,
|
||||
));
|
||||
$this->scheduledNodeRepo->create(new CreateScheduledNodeDto(
|
||||
date: new DateTimeImmutable('2025-01-02'),
|
||||
plan: $otherPlan,
|
||||
node: new Node(
|
||||
id: 0,
|
||||
title: 'other node',
|
||||
text: new Text(id: 0, name: 'test text'),
|
||||
parentNode: null,
|
||||
),
|
||||
));
|
||||
|
||||
$result = $this->useCase->execute(new GetTodaysScheduleRequest(
|
||||
date: '2025-01-02',
|
||||
userId: 0,
|
||||
));
|
||||
|
||||
$this->assertEquals(1, count($result));
|
||||
$resultNode = array_values($result)[0];
|
||||
$this->assertEquals(
|
||||
0,
|
||||
$resultNode->getPlan()->getUser()->getId()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue