Skip to content

Commit

Permalink
Add AbstractLocationRedirectionHttpExceptionTest
Browse files Browse the repository at this point in the history
  • Loading branch information
donatj committed Sep 9, 2024
1 parent d4c5f05 commit 1138e99
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ abstract class AbstractLocationRedirectionHttpException extends AbstractHttpExce
/**
* AbstractRedirectionHttpException constructor.
*
* @param string $message
* @param \Throwable $previous [optional] The previous throwable used for the exception chaining.
* @param \Throwable|null $previous [optional] The previous throwable used for the exception chaining.
*/
public function __construct( string $location, $message = '', ?\Throwable $previous = null ) {
public function __construct( string $location, string $message = '', ?\Throwable $previous = null ) {
$this->location = $location;

parent::__construct($message, $previous);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Corpus\Http\Exceptions\Redirection;

use PHPUnit\Framework\TestCase;

class AbstractLocationRedirectionHttpExceptionTest extends TestCase {

public function testGetHttpStatusCode() : void {
$e = new class ('http://www.example.com', 'found it') extends AbstractLocationRedirectionHttpException {

public function getHttpStatusCode() : int {
return 302;
}
};
$this->assertSame(302, $e->getHttpStatusCode());
$this->assertSame('http://www.example.com', $e->getLocation());
$this->assertSame('found it', $e->getMessage());
}

}

0 comments on commit 1138e99

Please sign in to comment.