File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 */
3838use CodeIgniter \HTTP \Exceptions \HTTPException ;
3939use BadMethodCallException ;
40+ use LogicException ;
4041use CodeIgniter \Files \File ;
4142use Config \Mimes ;
4243
@@ -488,7 +489,7 @@ public function sendBody()
488489 return $ this ->sendBodyByFilePath ();
489490 }
490491
491- throw new RuntimeException ( );
492+ throw new LogicException ( ' Not found download body source. ' );
492493 }
493494
494495 /**
Original file line number Diff line number Diff line change 66use DateTimeZone ;
77use BadMethodCallException ;
88use InvalidArgumentException ;
9+ use LogicException ;
910
1011class DownloadResponseTest extends \CIUnitTestCase
1112{
@@ -242,4 +243,12 @@ public function testCanOutputFileBodyFromFile()
242243
243244 $ this ->assertSame (file_get_contents (__FILE__ ), $ actual );
244245 }
246+
247+ public function testThrowExceptionWhenNoSetDownloadSource ()
248+ {
249+ $ response = new DownloadResponse ('unit-test.php ' , false );
250+
251+ $ this ->expectException (LogicException::class);
252+ $ response ->sendBody ();
253+ }
245254}
You can’t perform that action at this time.
0 commit comments