File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -242,15 +242,7 @@ public function getStatusCode(): int
242242 */
243243 public function setStatusCode (int $ code , string $ reason = '' )
244244 {
245- if ($ code !== 200 )
246- {
247- throw HTTPException::forInvalidStatusCode ($ code );
248- }
249-
250- if ( ! empty ($ reason ) && $ this ->reason !== $ reason )
251- {
252- $ this ->reason = $ reason ;
253- }
245+ throw DownloadException::forCannotSetStatusCode ($ code , $ reason );
254246 }
255247
256248 //--------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -23,21 +23,12 @@ public function testCanGetStatusCode()
2323 $ this ->assertSame (200 , $ response ->getStatusCode ());
2424 }
2525
26- public function testCanSetCustomReasonCode ()
26+ public function testCantSetStatusCode ()
2727 {
2828 $ response = new DownloadResponse ('unit-test.txt ' , true );
2929
30- $ response ->setStatusCode (200 , 'Not the mama ' );
31-
32- $ this ->assertSame ('Not the mama ' , $ response ->getReason ());
33- }
34-
35- public function testCantSet200OtherThanStatusCode ()
36- {
37- $ response = new DownloadResponse ('unit-test.txt ' , true );
38-
39- $ this ->expectException (HTTPException::class);
40- $ response ->setStatusCode (999 );
30+ $ this ->expectException (DownloadException::class);
31+ $ response ->setStatusCode (200 );
4132 }
4233
4334 public function testSetDateRemembersDateInUTC ()
You can’t perform that action at this time.
0 commit comments