remove default values from test helpers

This commit is contained in:
Yisroel Baum 2026-05-01 10:05:07 +03:00
parent 8b5767e6f4
commit c9f1379496
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -50,7 +50,7 @@ class ScheduledNodeControllerTest extends TestCase
private function makeRequest(
?string $date,
?User $user = null,
?User $user,
): ServerRequestInterface {
$request = new ServerRequestFactory()
->createServerRequest(
@ -69,8 +69,8 @@ class ScheduledNodeControllerTest extends TestCase
private function seedScheduledNode(
User $user,
string $date,
string $planName = 'My reading plan',
string $nodeTitle = 'Bereishis',
string $planName,
string $nodeTitle,
): void {
$plan = $this->planRepo->create(new CreatePlanDto(
name: $planName,
@ -90,7 +90,12 @@ class ScheduledNodeControllerTest extends TestCase
public function test_returns_200_with_scheduled_nodes_for_user(): void
{
$this->seedScheduledNode($this->user, '2025-01-02');
$this->seedScheduledNode(
$this->user,
'2025-01-02',
'My reading plan',
'Bereishis',
);
$response = $this->controller->getScheduledNodes(
$this->makeRequest('2025-01-02', $this->user),
@ -131,7 +136,7 @@ class ScheduledNodeControllerTest extends TestCase
public function test_returns_401_when_no_user_attribute(): void
{
$response = $this->controller->getScheduledNodes(
$this->makeRequest('2025-01-02'),
$this->makeRequest('2025-01-02', null),
new Response(),
$this->getTodaysSchedule,
);
@ -154,7 +159,12 @@ class ScheduledNodeControllerTest extends TestCase
public function test_excludes_future_scheduled_nodes(): void
{
$this->seedScheduledNode($this->user, '2025-01-10');
$this->seedScheduledNode(
$this->user,
'2025-01-10',
'My reading plan',
'Bereishis',
);
$response = $this->controller->getScheduledNodes(
$this->makeRequest('2025-01-02', $this->user),
@ -168,7 +178,12 @@ class ScheduledNodeControllerTest extends TestCase
public function test_excludes_completed_scheduled_nodes(): void
{
$this->seedScheduledNode($this->user, '2025-01-02');
$this->seedScheduledNode(
$this->user,
'2025-01-02',
'My reading plan',
'Bereishis',
);
$stored = $this->scheduledNodeRepo->find(0);
$stored->setCompleted(true);
$this->scheduledNodeRepo->update($stored);