77
88namespace ZendTest \Expressive \Middleware ;
99
10+ use Fig \Http \Message \StatusCodeInterface as StatusCode ;
1011use PHPUnit \Framework \TestCase ;
1112use Prophecy \Prophecy \ObjectProphecy ;
1213use Psr \Http \Message \ResponseInterface ;
@@ -58,7 +59,9 @@ public function testWritesResultsOfWhoopsExceptionsHandlingToResponse()
5859 $ this ->request ->getAttribute ('originalUri ' , false )->shouldNotBeCalled ();
5960 $ this ->request ->getAttribute ('originalRequest ' , false )->shouldNotBeCalled ();
6061
62+ $ this ->response ->withStatus (StatusCode::STATUS_INTERNAL_SERVER_ERROR )->will ([$ this ->response , 'reveal ' ]);
6163 $ this ->response ->getBody ()->will ([$ this ->stream , 'reveal ' ]);
64+ $ this ->response ->getStatusCode ()->willReturn (StatusCode::STATUS_INTERNAL_SERVER_ERROR );
6265
6366 $ this ->stream ->write ('WHOOPS ' )->shouldBeCalled ();
6467
@@ -72,7 +75,7 @@ public function testWritesResultsOfWhoopsExceptionsHandlingToResponse()
7275
7376 public function testAddsRequestMetadataToWhoopsPrettyPageHandler ()
7477 {
75- $ error = new RuntimeException ();
78+ $ error = new RuntimeException (' STATUS_INTERNAL_SERVER_ERROR ' , StatusCode:: STATUS_INTERNAL_SERVER_ERROR );
7679
7780 $ handler = $ this ->prophesize (PrettyPageHandler::class);
7881 $ handler
@@ -101,6 +104,8 @@ public function testAddsRequestMetadataToWhoopsPrettyPageHandler()
101104 $ this ->request ->getQueryParams ()->willReturn ([]);
102105 $ this ->request ->getParsedBody ()->willReturn ([]);
103106
107+ $ this ->response ->withStatus (StatusCode::STATUS_INTERNAL_SERVER_ERROR )->will ([$ this ->response , 'reveal ' ]);
108+ $ this ->response ->getStatusCode ()->willReturn (StatusCode::STATUS_INTERNAL_SERVER_ERROR );
104109 $ this ->response ->getBody ()->will ([$ this ->stream , 'reveal ' ]);
105110
106111 $ this ->stream ->write ('WHOOPS ' )->shouldBeCalled ();
@@ -115,7 +120,7 @@ public function testAddsRequestMetadataToWhoopsPrettyPageHandler()
115120
116121 public function testJsonContentTypeResponseWithJsonResponseHandler ()
117122 {
118- $ error = new RuntimeException ();
123+ $ error = new RuntimeException (' STATUS_NOT_IMPLEMENTED ' , StatusCode:: STATUS_NOT_IMPLEMENTED );
119124
120125 $ handler = $ this ->prophesize (JsonResponseHandler::class);
121126
@@ -137,6 +142,8 @@ public function testJsonContentTypeResponseWithJsonResponseHandler()
137142 $ this ->request ->getParsedBody ()->willReturn ([]);
138143
139144 $ this ->response ->withHeader ('Content-Type ' , 'application/json ' )->will ([$ this ->response , 'reveal ' ]);
145+ $ this ->response ->withStatus (StatusCode::STATUS_NOT_IMPLEMENTED )->will ([$ this ->response , 'reveal ' ]);
146+ $ this ->response ->getStatusCode ()->willReturn (StatusCode::STATUS_NOT_IMPLEMENTED );
140147 $ this ->response ->getBody ()->will ([$ this ->stream , 'reveal ' ]);
141148
142149 $ this ->stream ->write ('error ' )->shouldBeCalled ();
0 commit comments