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:
parent
40fdf25da2
commit
cbbbc80326
9 changed files with 71 additions and 22 deletions
|
|
@ -35,19 +35,20 @@ class CreateScheduledNodeTest extends TestCase
|
|||
$this->scheduledNodeRepo = new FakeScheduledNodeRepository();
|
||||
$this->planRepo = new FakePlanRepository();
|
||||
$this->nodeRepo = new FakeNodeRepository();
|
||||
$user = new User(
|
||||
id: 0,
|
||||
email: new EmailAddress('test@test.com'),
|
||||
passwordHash: 'hashed:password1',
|
||||
isAdmin: false,
|
||||
);
|
||||
$this->nodeRepo->create(new CreateNodeDto(
|
||||
text: new Text(0, 'text name'),
|
||||
text: new Text(0, 'text name', $user),
|
||||
title: 'test node',
|
||||
parentNode: null,
|
||||
));
|
||||
$this->planRepo->create(new CreatePlanDto(
|
||||
name: 'testplan',
|
||||
user: new User(
|
||||
id: 0,
|
||||
email: new EmailAddress('test@test.com'),
|
||||
passwordHash: 'hashed:password1',
|
||||
isAdmin: false,
|
||||
),
|
||||
user: $user,
|
||||
));
|
||||
$this->useCase = new CreateScheduledNode(
|
||||
$this->scheduledNodeRepo,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
),
|
||||
));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue