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