| @@ 1750-1774 (lines=25) @@ | ||
| 1747 | ); |
|
| 1748 | } |
|
| 1749 | ||
| 1750 | public function testDispatchAbort() |
|
| 1751 | { |
|
| 1752 | $this->expectOutputString('1,'); |
|
| 1753 | ||
| 1754 | $this->klein_app->respond( |
|
| 1755 | function ($a, $b, $c, $d, $klein_app) { |
|
| 1756 | echo '1,'; |
|
| 1757 | } |
|
| 1758 | ); |
|
| 1759 | $this->klein_app->respond( |
|
| 1760 | function ($a, $b, $c, $d, $klein_app) { |
|
| 1761 | $klein_app->abort(); |
|
| 1762 | echo '2,'; |
|
| 1763 | } |
|
| 1764 | ); |
|
| 1765 | $this->klein_app->respond( |
|
| 1766 | function ($a, $b, $c, $d, $klein_app) { |
|
| 1767 | echo '3,'; |
|
| 1768 | } |
|
| 1769 | ); |
|
| 1770 | ||
| 1771 | $this->klein_app->dispatch(); |
|
| 1772 | ||
| 1773 | $this->assertSame(404, $this->klein_app->response()->code()); |
|
| 1774 | } |
|
| 1775 | ||
| 1776 | public function testDispatchAbortWithCode() |
|
| 1777 | { |
|
| @@ 1776-1800 (lines=25) @@ | ||
| 1773 | $this->assertSame(404, $this->klein_app->response()->code()); |
|
| 1774 | } |
|
| 1775 | ||
| 1776 | public function testDispatchAbortWithCode() |
|
| 1777 | { |
|
| 1778 | $this->expectOutputString('1,'); |
|
| 1779 | ||
| 1780 | $this->klein_app->respond( |
|
| 1781 | function ($a, $b, $c, $d, $klein_app) { |
|
| 1782 | echo '1,'; |
|
| 1783 | } |
|
| 1784 | ); |
|
| 1785 | $this->klein_app->respond( |
|
| 1786 | function ($a, $b, $c, $d, $klein_app) { |
|
| 1787 | $klein_app->abort(404); |
|
| 1788 | echo '2,'; |
|
| 1789 | } |
|
| 1790 | ); |
|
| 1791 | $this->klein_app->respond( |
|
| 1792 | function ($a, $b, $c, $d, $klein_app) { |
|
| 1793 | echo '3,'; |
|
| 1794 | } |
|
| 1795 | ); |
|
| 1796 | ||
| 1797 | $this->klein_app->dispatch(); |
|
| 1798 | ||
| 1799 | $this->assertSame(404, $this->klein_app->response()->code()); |
|
| 1800 | } |
|
| 1801 | ||
| 1802 | public function testDispatchAbortCallsHttpError() |
|
| 1803 | { |
|