update downstream tests for text user requirement

Text now requires a User on construction. seed a user in
each test setUp that creates a Text directly or through the
fake repository so the suite remains green.
This commit is contained in:
Yisroel Baum 2026-05-02 21:27:55 +03:00
parent 40fdf25da2
commit cbbbc80326
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
9 changed files with 71 additions and 22 deletions

View file

@ -29,19 +29,21 @@ class GetTodaysScheduleTest extends TestCase
private GetTodaysSchedule $useCase;
private \App\User\User $user;
protected function setUp(): void
{
$this->userRepo = new FakeUserRepository();
$this->scheduledNodeRepo = new FakeScheduledNodeRepository();
$this->planRepo = new FakePlanRepository();
$user = $this->userRepo->create(new CreateUserDto(
$this->user = $this->userRepo->create(new CreateUserDto(
email: new EmailAddress('email@email.com'),
passwordHash: 'hash',
isAdmin: false,
));
$plan = $this->planRepo->create(new CreatePlanDto(
name: 'test plan',
user: $user,
user: $this->user,
));
$this->scheduledNodeRepo->create(new CreateScheduledNodeDto(
date: new DateTimeImmutable('2025-01-02'),
@ -49,7 +51,7 @@ class GetTodaysScheduleTest extends TestCase
node: new Node(
id: 0,
title: 'test node',
text: new Text(id: 0, name: 'test text'),
text: new Text(id: 0, name: 'test text', user: $this->user),
parentNode: null,
),
));
@ -79,7 +81,7 @@ class GetTodaysScheduleTest extends TestCase
node: new Node(
id: 0,
title: 'test node',
text: new Text(id: 0, name: 'test text'),
text: new Text(id: 0, name: 'test text', user: $this->user),
parentNode: null,
),
));
@ -99,7 +101,7 @@ class GetTodaysScheduleTest extends TestCase
node: new Node(
id: 0,
title: 'test node',
text: new Text(id: 0, name: 'test text'),
text: new Text(id: 0, name: 'test text', user: $this->user),
parentNode: null,
),
)
@ -172,7 +174,7 @@ class GetTodaysScheduleTest extends TestCase
node: new Node(
id: 0,
title: 'future node',
text: new Text(id: 0, name: 'test text'),
text: new Text(id: 0, name: 'test text', user: $this->user),
parentNode: null,
),
));
@ -202,7 +204,7 @@ class GetTodaysScheduleTest extends TestCase
node: new Node(
id: 0,
title: 'other node',
text: new Text(id: 0, name: 'test text'),
text: new Text(id: 0, name: 'test text', user: $otherUser),
parentNode: null,
),
));