Skip to content

Commit

Permalink
fix(http): correct HTTP 418 description and coverage (tempestphp#823)
Browse files Browse the repository at this point in the history
Co-authored-by: Enzo Innocenzi <[email protected]>
  • Loading branch information
blackshadev and innocenzi authored Dec 6, 2024
1 parent 1bd7a67 commit dbad109
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Tempest/Http/src/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function description(): string
415 => 'Unsupported Media Type',
416 => 'Range Not Satisfiable',
417 => 'Expectation Failed',
418 => 'I Am A Teapot',
418 => "I'm a teapot",
421 => 'Misdirected Request',
422 => 'Unprocessable Content',
423 => 'Locked',
Expand Down
8 changes: 5 additions & 3 deletions src/Tempest/Http/tests/StatusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*/
final class StatusTest extends TestCase
{
private function descriptionToStatus(string $description): Status
private static function descriptionToStatus(string $description): Status
{
$description = strtoupper(
str_replace([' ', '-'], '_', $description),
str_replace("'", '', str_replace([' ', '-'], '_', $description)),
);

return Status::{$description};
Expand All @@ -28,7 +28,7 @@ public function test_status_code(int $code, string $description): void
$status = Status::code($code);

$this->assertSame(
$this->descriptionToStatus($description),
self::descriptionToStatus($description),
$status,
);

Expand Down Expand Up @@ -100,6 +100,7 @@ public static function provide_status_code_cases(): iterable
[303, 'See Other'],
[304, 'Not Modified'],
[305, 'Use Proxy'],
[306, 'Unused'],
[307, 'Temporary Redirect'],
[308, 'Permanent Redirect'],

Expand All @@ -121,6 +122,7 @@ public static function provide_status_code_cases(): iterable
[415, 'Unsupported Media Type'],
[416, 'Range Not Satisfiable'],
[417, 'Expectation Failed'],
[418, "I'm a teapot"],
[421, 'Misdirected Request'],
[422, 'Unprocessable Content'],
[423, 'Locked'],
Expand Down

0 comments on commit dbad109

Please sign in to comment.