33
44namespace Middlewares \Tests ;
55
6- use Eloquent \Phony \Phpunit \Phony ;
76use Middlewares \Utils \Dispatcher ;
87use Middlewares \Utils \Factory ;
98use Middlewares \Whoops ;
1211
1312class HandlerTest extends TestCase
1413{
15- private static function getContainer ()
14+ private static function getContainer (): WhoopsHandlerContainer
1615 {
17- $ container = Phony::partialMock (WhoopsHandlerContainer::class)->get ();
18- Phony::onStatic ($ container )->isCli ->returns (false );
19-
20- return $ container ;
16+ return new class () extends WhoopsHandlerContainer {
17+ protected static function isCli (): bool
18+ {
19+ return false ;
20+ }
21+ };
2122 }
2223
23- public function testJson ()
24+ public function testJson (): void
2425 {
2526 $ request = Factory::createServerRequest ('GET ' , '/ ' )->withHeader ('Accept ' , 'application/json ' );
2627
@@ -35,7 +36,7 @@ function () {
3536 $ this ->assertEquals ('application/json ' , $ response ->getHeaderLine ('Content-Type ' ));
3637 }
3738
38- public function testXml ()
39+ public function testXml (): void
3940 {
4041 $ request = Factory::createServerRequest ('GET ' , '/ ' )->withHeader ('Accept ' , 'text/xml ' );
4142
@@ -50,7 +51,7 @@ function () {
5051 $ this ->assertEquals ('text/xml ' , $ response ->getHeaderLine ('Content-Type ' ));
5152 }
5253
53- public function testPlain ()
54+ public function testPlain (): void
5455 {
5556 $ request = Factory::createServerRequest ('GET ' , '/ ' )->withHeader ('Accept ' , 'text/plain ' );
5657
@@ -65,7 +66,7 @@ function () {
6566 $ this ->assertEquals ('text/plain ' , $ response ->getHeaderLine ('Content-Type ' ));
6667 }
6768
68- public function testHtml ()
69+ public function testHtml (): void
6970 {
7071 $ request = Factory::createServerRequest ('GET ' , '/ ' )->withHeader ('Accept ' , 'text/html ' );
7172
@@ -80,7 +81,7 @@ function () {
8081 $ this ->assertEquals ('text/html ' , $ response ->getHeaderLine ('Content-Type ' ));
8182 }
8283
83- public function testDefault ()
84+ public function testDefault (): void
8485 {
8586 $ request = Factory::createServerRequest ('GET ' , '/ ' )->withHeader ('Accept ' , 'foo/bar ' );
8687
@@ -95,7 +96,7 @@ function () {
9596 $ this ->assertEquals ('text/html ' , $ response ->getHeaderLine ('Content-Type ' ));
9697 }
9798
98- public function testEmptyAccept ()
99+ public function testEmptyAccept (): void
99100 {
100101 $ response = Dispatcher::run ([
101102 (new Whoops ())->handlerContainer (self ::getContainer ()),
0 commit comments