Skip to content

Commit 1138e99

Browse files
committed
Add AbstractLocationRedirectionHttpExceptionTest
1 parent d4c5f05 commit 1138e99

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/Exceptions/Redirection/AbstractLocationRedirectionHttpException.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ abstract class AbstractLocationRedirectionHttpException extends AbstractHttpExce
1717
/**
1818
* AbstractRedirectionHttpException constructor.
1919
*
20-
* @param string $message
21-
* @param \Throwable $previous [optional] The previous throwable used for the exception chaining.
20+
* @param \Throwable|null $previous [optional] The previous throwable used for the exception chaining.
2221
*/
23-
public function __construct( string $location, $message = '', ?\Throwable $previous = null ) {
22+
public function __construct( string $location, string $message = '', ?\Throwable $previous = null ) {
2423
$this->location = $location;
2524

2625
parent::__construct($message, $previous);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Corpus\Http\Exceptions\Redirection;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
class AbstractLocationRedirectionHttpExceptionTest extends TestCase {
8+
9+
public function testGetHttpStatusCode() : void {
10+
$e = new class ('http://www.example.com', 'found it') extends AbstractLocationRedirectionHttpException {
11+
12+
public function getHttpStatusCode() : int {
13+
return 302;
14+
}
15+
};
16+
$this->assertSame(302, $e->getHttpStatusCode());
17+
$this->assertSame('http://www.example.com', $e->getLocation());
18+
$this->assertSame('found it', $e->getMessage());
19+
}
20+
21+
}

0 commit comments

Comments
 (0)