Skip to content

Commit

Permalink
Merge a90e127 into a24fac2
Browse files Browse the repository at this point in the history
  • Loading branch information
akrabat committed Oct 3, 2019
2 parents a24fac2 + a90e127 commit 6d603b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions Slim/Exception/HttpMethodNotAllowedException.php
Expand Up @@ -36,6 +36,7 @@ public function getAllowedMethods(): array
public function setAllowedMethods(array $methods): HttpMethodNotAllowedException
{
$this->allowedMethods = $methods;
$this->message = 'Method not allowed. Must be one of: ' . implode(', ', $methods);
return $this;
}
}
2 changes: 2 additions & 0 deletions tests/Exception/HttpExceptionTest.php
Expand Up @@ -43,8 +43,10 @@ public function testHttpNotAllowedExceptionGetAllowedMethods()
$exception = new HttpMethodNotAllowedException($request);
$exception->setAllowedMethods(['GET']);
$this->assertEquals(['GET'], $exception->getAllowedMethods());
$this->assertEquals('Method not allowed. Must be one of: GET', $exception->getMessage());

$exception = new HttpMethodNotAllowedException($request);
$this->assertEquals([], $exception->getAllowedMethods());
$this->assertEquals('Method not allowed.', $exception->getMessage());
}
}

0 comments on commit 6d603b5

Please sign in to comment.