Skip to content

Commit

Permalink
Add test for time formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 27, 2023
1 parent f1b0bb7 commit e069c84
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/TestCase/Controller/TasksControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,18 @@ public function testDailyCalendarItems(): void

$this->assertResponseOk();

$items = $this->viewVariable('calendarItems')->toArray();
// Check the view variables.
$items = $this->viewVariable('calendarItems');
$this->assertCount(3, $items);
$itemIds = collection($items)->extract('id')->toList();
$this->assertEquals([$allDay->id, $early->id, $late->id], $itemIds);

// Check the time formatting
$this->assertResponseContains('early event');
$this->assertResponseContains($startOfDay->format('H:i'));

$this->assertResponseContains('late event');
$this->assertResponseContains($endOfDay->modify('-1 hour')->format('H:i'));
}

public function testIndexCalendarItems(): void
Expand Down

0 comments on commit e069c84

Please sign in to comment.