diff --git a/src/Auth/BasicAuthenticate.php b/src/Auth/BasicAuthenticate.php index db3d3cd9017..9ca589adec9 100644 --- a/src/Auth/BasicAuthenticate.php +++ b/src/Auth/BasicAuthenticate.php @@ -14,9 +14,9 @@ */ namespace Cake\Auth; +use Cake\Http\Exception\UnauthorizedException; use Cake\Http\Response; use Cake\Http\ServerRequest; -use Cake\Network\Exception\UnauthorizedException; /** * Basic Authentication adapter for AuthComponent. @@ -89,7 +89,7 @@ public function getUser(ServerRequest $request) * @param \Cake\Http\ServerRequest $request A request object. * @param \Cake\Http\Response $response A response object. * @return void - * @throws \Cake\Network\Exception\UnauthorizedException + * @throws \Cake\Http\Exception\UnauthorizedException */ public function unauthenticated(ServerRequest $request, Response $response) { diff --git a/src/Controller/Component/AuthComponent.php b/src/Controller/Component/AuthComponent.php index 66a269b24e4..5fea7a06a41 100644 --- a/src/Controller/Component/AuthComponent.php +++ b/src/Controller/Component/AuthComponent.php @@ -21,9 +21,9 @@ use Cake\Core\Exception\Exception; use Cake\Event\Event; use Cake\Event\EventDispatcherTrait; +use Cake\Http\Exception\ForbiddenException; use Cake\Http\Response; use Cake\Http\ServerRequest; -use Cake\Network\Exception\ForbiddenException; use Cake\Routing\Router; use Cake\Utility\Hash; @@ -456,7 +456,7 @@ protected function _isLoginAction(Controller $controller) * * @param \Cake\Controller\Controller $controller A reference to the controller object * @return \Cake\Http\Response - * @throws \Cake\Network\Exception\ForbiddenException + * @throws \Cake\Http\Exception\ForbiddenException */ protected function _unauthorized(Controller $controller) { diff --git a/src/Controller/Component/CsrfComponent.php b/src/Controller/Component/CsrfComponent.php index 0bf98081f9f..07904773510 100644 --- a/src/Controller/Component/CsrfComponent.php +++ b/src/Controller/Component/CsrfComponent.php @@ -16,10 +16,10 @@ use Cake\Controller\Component; use Cake\Event\Event; +use Cake\Http\Exception\InvalidCsrfTokenException; use Cake\Http\Response; use Cake\Http\ServerRequest; use Cake\I18n\Time; -use Cake\Network\Exception\InvalidCsrfTokenException; use Cake\Utility\Security; /** @@ -149,7 +149,7 @@ protected function _setCookie(ServerRequest $request, Response $response) * Validate the request data against the cookie token. * * @param \Cake\Http\ServerRequest $request The request to validate against. - * @throws \Cake\Network\Exception\InvalidCsrfTokenException when the CSRF token is invalid or missing. + * @throws \Cake\Http\Exception\InvalidCsrfTokenException when the CSRF token is invalid or missing. * @return void */ protected function _validateToken(ServerRequest $request) diff --git a/src/Controller/Component/FlashComponent.php b/src/Controller/Component/FlashComponent.php index b9099bf7308..ab5be27e9d7 100644 --- a/src/Controller/Component/FlashComponent.php +++ b/src/Controller/Component/FlashComponent.php @@ -16,7 +16,7 @@ use Cake\Controller\Component; use Cake\Controller\ComponentRegistry; -use Cake\Network\Exception\InternalErrorException; +use Cake\Http\Exception\InternalErrorException; use Cake\Utility\Inflector; use Exception; @@ -150,7 +150,7 @@ public function set($message, array $options = []) * @param string $name Element name to use. * @param array $args Parameters to pass when calling `FlashComponent::set()`. * @return void - * @throws \Cake\Network\Exception\InternalErrorException If missing the flash message. + * @throws \Cake\Http\Exception\InternalErrorException If missing the flash message. */ public function __call($name, $args) { diff --git a/src/Controller/Component/PaginatorComponent.php b/src/Controller/Component/PaginatorComponent.php index eada6cd6e0e..eaa28d0730f 100644 --- a/src/Controller/Component/PaginatorComponent.php +++ b/src/Controller/Component/PaginatorComponent.php @@ -18,7 +18,7 @@ use Cake\Controller\ComponentRegistry; use Cake\Datasource\Exception\PageOutOfBoundsException; use Cake\Datasource\Paginator; -use Cake\Network\Exception\NotFoundException; +use Cake\Http\Exception\NotFoundException; use InvalidArgumentException; /** @@ -187,7 +187,7 @@ public function implementedEvents() * @param \Cake\Datasource\RepositoryInterface|\Cake\Datasource\QueryInterface $object The table or query to paginate. * @param array $settings The settings/configuration used for pagination. * @return \Cake\Datasource\ResultSetInterface Query results - * @throws \Cake\Network\Exception\NotFoundException + * @throws \Cake\Http\Exception\NotFoundException */ public function paginate($object, array $settings = []) { diff --git a/src/Controller/Component/SecurityComponent.php b/src/Controller/Component/SecurityComponent.php index 37e182eb624..f2e985ae37d 100644 --- a/src/Controller/Component/SecurityComponent.php +++ b/src/Controller/Component/SecurityComponent.php @@ -20,8 +20,8 @@ use Cake\Controller\Exception\SecurityException; use Cake\Core\Configure; use Cake\Event\Event; +use Cake\Http\Exception\BadRequestException; use Cake\Http\ServerRequest; -use Cake\Network\Exception\BadRequestException; use Cake\Utility\Hash; use Cake\Utility\Security; @@ -180,7 +180,7 @@ public function requireAuth($actions) * @return mixed If specified, controller blackHoleCallback's response, or no return otherwise * @see \Cake\Controller\Component\SecurityComponent::$blackHoleCallback * @link https://book.cakephp.org/3.0/en/controllers/components/security.html#handling-blackhole-callbacks - * @throws \Cake\Network\Exception\BadRequestException + * @throws \Cake\Http\Exception\BadRequestException */ public function blackHole(Controller $controller, $error = '', SecurityException $exception = null) { @@ -195,7 +195,7 @@ public function blackHole(Controller $controller, $error = '', SecurityException * Check debug status and throw an Exception based on the existing one * * @param \Cake\Controller\Exception\SecurityException|null $exception Additional debug info describing the cause - * @throws \Cake\Network\Exception\BadRequestException + * @throws \Cake\Http\Exception\BadRequestException * @return void */ protected function _throwException($exception = null) @@ -588,7 +588,7 @@ public function generateToken(ServerRequest $request) * @param string $method Method to execute * @param array $params Parameters to send to method * @return mixed Controller callback method's response - * @throws \Cake\Network\Exception\BadRequestException When a the blackholeCallback is not callable. + * @throws \Cake\Http\Exception\BadRequestException When a the blackholeCallback is not callable. */ protected function _callback(Controller $controller, $method, $params = []) { diff --git a/src/Controller/Exception/SecurityException.php b/src/Controller/Exception/SecurityException.php index 6fe98cd13e5..efcd18aea50 100644 --- a/src/Controller/Exception/SecurityException.php +++ b/src/Controller/Exception/SecurityException.php @@ -12,7 +12,7 @@ */ namespace Cake\Controller\Exception; -use Cake\Network\Exception\BadRequestException; +use Cake\Http\Exception\BadRequestException; /** * Security exception - used when SecurityComponent detects any issue with the current request diff --git a/src/Error/ExceptionRenderer.php b/src/Error/ExceptionRenderer.php index 6352a9203aa..80fe8128019 100644 --- a/src/Error/ExceptionRenderer.php +++ b/src/Error/ExceptionRenderer.php @@ -20,9 +20,9 @@ use Cake\Core\Exception\Exception as CakeException; use Cake\Core\Exception\MissingPluginException; use Cake\Event\Event; +use Cake\Http\Exception\HttpException; use Cake\Http\Response; use Cake\Http\ServerRequestFactory; -use Cake\Network\Exception\HttpException; use Cake\Routing\DispatcherFactory; use Cake\Routing\Router; use Cake\Utility\Inflector; diff --git a/src/Http/Client/Adapter/Stream.php b/src/Http/Client/Adapter/Stream.php index ec0359f169d..81e5742c0a2 100644 --- a/src/Http/Client/Adapter/Stream.php +++ b/src/Http/Client/Adapter/Stream.php @@ -16,7 +16,7 @@ use Cake\Core\Exception\Exception; use Cake\Http\Client\Request; use Cake\Http\Client\Response; -use Cake\Network\Exception\HttpException; +use Cake\Http\Exception\HttpException; /** * Implements sending Cake\Http\Client\Request @@ -239,7 +239,7 @@ protected function _buildSslContext(Request $request, $options) * * @param \Cake\Http\Client\Request $request The request object. * @return array Array of populated Response objects - * @throws \Cake\Network\Exception\HttpException + * @throws \Cake\Http\Exception\HttpException */ protected function _send(Request $request) { diff --git a/src/Http/Middleware/CsrfProtectionMiddleware.php b/src/Http/Middleware/CsrfProtectionMiddleware.php index 35ac42fa8d0..890235f9701 100644 --- a/src/Http/Middleware/CsrfProtectionMiddleware.php +++ b/src/Http/Middleware/CsrfProtectionMiddleware.php @@ -14,10 +14,10 @@ */ namespace Cake\Http\Middleware; +use Cake\Http\Exception\InvalidCsrfTokenException; use Cake\Http\Response; use Cake\Http\ServerRequest; use Cake\I18n\Time; -use Cake\Network\Exception\InvalidCsrfTokenException; use Cake\Utility\Hash; use Cake\Utility\Security; @@ -177,7 +177,7 @@ protected function _addTokenCookie($token, ServerRequest $request, Response $res * * @param \Cake\Http\ServerRequest $request The request to validate against. * @return void - * @throws \Cake\Network\Exception\InvalidCsrfTokenException When the CSRF token is invalid or missing. + * @throws \Cake\Http\Exception\InvalidCsrfTokenException When the CSRF token is invalid or missing. */ protected function _validateToken(ServerRequest $request) { diff --git a/src/Http/Response.php b/src/Http/Response.php index 66c795e8cef..c6d803034b0 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -19,9 +19,9 @@ use Cake\Http\Cookie\Cookie; use Cake\Http\Cookie\CookieCollection; use Cake\Http\Cookie\CookieInterface; +use Cake\Http\Exception\NotFoundException; use Cake\Log\Log; use Cake\Network\CorsBuilder; -use Cake\Network\Exception\NotFoundException; use DateTime; use DateTimeZone; use InvalidArgumentException; @@ -2388,7 +2388,7 @@ public function cors(ServerRequest $request, $allowedDomains = [], $allowedMetho * to a file, `APP` will be prepended to the path. * @param array $options Options See above. * @return void - * @throws \Cake\Network\Exception\NotFoundException + * @throws \Cake\Http\Exception\NotFoundException * @deprecated 3.4.0 Use withFile() instead. */ public function file($path, array $options = []) @@ -2462,7 +2462,7 @@ public function file($path, array $options = []) * to a file, `APP` will be prepended to the path. * @param array $options Options See above. * @return static - * @throws \Cake\Network\Exception\NotFoundException + * @throws \Cake\Http\Exception\NotFoundException */ public function withFile($path, array $options = []) { @@ -2533,7 +2533,7 @@ public function withStringBody($string) * Validate a file path is a valid response body. * * @param string $path The path to the file. - * @throws \Cake\Network\Exception\NotFoundException + * @throws \Cake\Http\Exception\NotFoundException * @return \Cake\Filesystem\File */ protected function validateFile($path) diff --git a/src/Http/ServerRequest.php b/src/Http/ServerRequest.php index 2f6521cadb9..7c57a38bc64 100644 --- a/src/Http/ServerRequest.php +++ b/src/Http/ServerRequest.php @@ -18,7 +18,7 @@ use BadMethodCallException; use Cake\Core\Configure; use Cake\Http\Cookie\CookieCollection; -use Cake\Network\Exception\MethodNotAllowedException; +use Cake\Http\Exception\MethodNotAllowedException; use Cake\Network\Session; use Cake\Utility\Hash; use InvalidArgumentException; @@ -1895,7 +1895,7 @@ public function env($key, $value = null, $default = null) * * @param string|array $methods Allowed HTTP request methods. * @return bool true - * @throws \Cake\Network\Exception\MethodNotAllowedException + * @throws \Cake\Http\Exception\MethodNotAllowedException */ public function allowMethod($methods) { diff --git a/src/Routing/Filter/AssetFilter.php b/src/Routing/Filter/AssetFilter.php index 1c925777ec5..c54b25f0d7d 100644 --- a/src/Routing/Filter/AssetFilter.php +++ b/src/Routing/Filter/AssetFilter.php @@ -62,7 +62,7 @@ public function __construct($config = []) * * @param \Cake\Event\Event $event Event containing the request and response object * @return \Cake\Http\Response|null If the client is requesting a recognized asset, null otherwise - * @throws \Cake\Network\Exception\NotFoundException When asset not found + * @throws \Cake\Http\Exception\NotFoundException When asset not found */ public function beforeDispatch(Event $event) { diff --git a/tests/TestCase/Auth/BasicAuthenticateTest.php b/tests/TestCase/Auth/BasicAuthenticateTest.php index 36a14539d15..4f09cc23dda 100644 --- a/tests/TestCase/Auth/BasicAuthenticateTest.php +++ b/tests/TestCase/Auth/BasicAuthenticateTest.php @@ -16,10 +16,10 @@ use Cake\Auth\BasicAuthenticate; use Cake\Controller\ComponentRegistry; +use Cake\Http\Exception\UnauthorizedException; use Cake\Http\Response; use Cake\Http\ServerRequest; use Cake\I18n\Time; -use Cake\Network\Exception\UnauthorizedException; use Cake\ORM\TableRegistry; use Cake\TestSuite\TestCase; @@ -218,7 +218,7 @@ public function testAuthenticateSuccess() */ public function testAuthenticateFailReChallenge() { - $this->expectException(\Cake\Network\Exception\UnauthorizedException::class); + $this->expectException(\Cake\Http\Exception\UnauthorizedException::class); $this->expectExceptionCode(401); $this->auth->setConfig('scope.username', 'nate'); $request = new ServerRequest([ diff --git a/tests/TestCase/Auth/DigestAuthenticateTest.php b/tests/TestCase/Auth/DigestAuthenticateTest.php index 38456a63147..8da3e04e4c1 100644 --- a/tests/TestCase/Auth/DigestAuthenticateTest.php +++ b/tests/TestCase/Auth/DigestAuthenticateTest.php @@ -19,10 +19,10 @@ use Cake\Auth\DigestAuthenticate; use Cake\Controller\ComponentRegistry; use Cake\Core\Configure; +use Cake\Http\Exception\UnauthorizedException; use Cake\Http\Response; use Cake\Http\ServerRequest; use Cake\I18n\Time; -use Cake\Network\Exception\UnauthorizedException; use Cake\ORM\Entity; use Cake\ORM\TableRegistry; use Cake\TestSuite\TestCase; @@ -111,7 +111,7 @@ public function testAuthenticateNoData() */ public function testAuthenticateWrongUsername() { - $this->expectException(\Cake\Network\Exception\UnauthorizedException::class); + $this->expectException(\Cake\Http\Exception\UnauthorizedException::class); $this->expectExceptionCode(401); $request = new ServerRequest('posts/index'); $request->addParams(['pass' => []]); @@ -355,7 +355,7 @@ public function testAuthenticateSuccessSimulatedRequestMethod() */ public function testAuthenticateFailReChallenge() { - $this->expectException(\Cake\Network\Exception\UnauthorizedException::class); + $this->expectException(\Cake\Http\Exception\UnauthorizedException::class); $this->expectExceptionCode(401); $this->auth->setConfig('scope.username', 'nate'); $request = new ServerRequest([ diff --git a/tests/TestCase/Console/ConsoleErrorHandlerTest.php b/tests/TestCase/Console/ConsoleErrorHandlerTest.php index 2d78537877b..e772b877067 100644 --- a/tests/TestCase/Console/ConsoleErrorHandlerTest.php +++ b/tests/TestCase/Console/ConsoleErrorHandlerTest.php @@ -16,9 +16,9 @@ use Cake\Controller\Exception\MissingActionException; use Cake\Core\Exception\Exception; +use Cake\Http\Exception\InternalErrorException; +use Cake\Http\Exception\NotFoundException; use Cake\Log\Log; -use Cake\Network\Exception\InternalErrorException; -use Cake\Network\Exception\NotFoundException; use Cake\TestSuite\TestCase; /** diff --git a/tests/TestCase/Controller/Component/AuthComponentTest.php b/tests/TestCase/Controller/Component/AuthComponentTest.php index abafccb396d..089207e3a0e 100644 --- a/tests/TestCase/Controller/Component/AuthComponentTest.php +++ b/tests/TestCase/Controller/Component/AuthComponentTest.php @@ -994,7 +994,7 @@ public function testRedirectToUnauthorizedRedirectSuppressedAuthError() */ public function testForbiddenException() { - $this->expectException(\Cake\Network\Exception\ForbiddenException::class); + $this->expectException(\Cake\Http\Exception\ForbiddenException::class); $url = '/party/on'; $this->Auth->request = $request = new ServerRequest($url); $this->Auth->request->addParams(['controller' => 'Party', 'action' => 'on']); @@ -1591,7 +1591,7 @@ public function testUser() */ public function testStatelessAuthNoRedirect() { - $this->expectException(\Cake\Network\Exception\UnauthorizedException::class); + $this->expectException(\Cake\Http\Exception\UnauthorizedException::class); $this->expectExceptionCode(401); $event = new Event('Controller.startup', $this->Controller); $_SESSION = []; diff --git a/tests/TestCase/Controller/Component/CsrfComponentTest.php b/tests/TestCase/Controller/Component/CsrfComponentTest.php index b83cf97c557..ec863486efa 100644 --- a/tests/TestCase/Controller/Component/CsrfComponentTest.php +++ b/tests/TestCase/Controller/Component/CsrfComponentTest.php @@ -172,7 +172,7 @@ public function testValidTokenInHeader($method) */ public function testInvalidTokenInHeader($method) { - $this->expectException(\Cake\Network\Exception\InvalidCsrfTokenException::class); + $this->expectException(\Cake\Http\Exception\InvalidCsrfTokenException::class); $controller = $this->getMockBuilder('Cake\Controller\Controller') ->setMethods(['redirect']) ->getMock(); @@ -225,7 +225,7 @@ public function testValidTokenRequestData($method) */ public function testInvalidTokenRequestData($method) { - $this->expectException(\Cake\Network\Exception\InvalidCsrfTokenException::class); + $this->expectException(\Cake\Http\Exception\InvalidCsrfTokenException::class); $controller = $this->getMockBuilder('Cake\Controller\Controller') ->setMethods(['redirect']) ->getMock(); @@ -249,7 +249,7 @@ public function testInvalidTokenRequestData($method) */ public function testInvalidTokenRequestDataMissing() { - $this->expectException(\Cake\Network\Exception\InvalidCsrfTokenException::class); + $this->expectException(\Cake\Http\Exception\InvalidCsrfTokenException::class); $controller = $this->getMockBuilder('Cake\Controller\Controller') ->setMethods(['redirect']) ->getMock(); @@ -274,7 +274,7 @@ public function testInvalidTokenRequestDataMissing() */ public function testInvalidTokenMissingCookie($method) { - $this->expectException(\Cake\Network\Exception\InvalidCsrfTokenException::class); + $this->expectException(\Cake\Http\Exception\InvalidCsrfTokenException::class); $controller = $this->getMockBuilder('Cake\Controller\Controller') ->setMethods(['redirect']) ->getMock(); diff --git a/tests/TestCase/Controller/Component/PaginatorComponentTest.php b/tests/TestCase/Controller/Component/PaginatorComponentTest.php index 0b10609f74e..30f977718f4 100644 --- a/tests/TestCase/Controller/Component/PaginatorComponentTest.php +++ b/tests/TestCase/Controller/Component/PaginatorComponentTest.php @@ -22,7 +22,7 @@ use Cake\Datasource\Exception\PageOutOfBoundsException; use Cake\Datasource\Paginator; use Cake\Http\ServerRequest; -use Cake\Network\Exception\NotFoundException; +use Cake\Http\Exception\NotFoundException; use Cake\ORM\Entity; use Cake\ORM\TableRegistry; use Cake\TestSuite\TestCase; @@ -772,7 +772,7 @@ public function testOutOfRangePageNumberStillProvidesPageCount() */ public function testOutOfVeryBigPageNumberGetsClamped() { - $this->expectException(\Cake\Network\Exception\NotFoundException::class); + $this->expectException(\Cake\Http\Exception\NotFoundException::class); $this->loadFixtures('Posts'); $this->request->query = [ 'page' => '3000000000000000000000000', diff --git a/tests/TestCase/Controller/Component/SecurityComponentTest.php b/tests/TestCase/Controller/Component/SecurityComponentTest.php index 683282a12cb..c47148a630f 100644 --- a/tests/TestCase/Controller/Component/SecurityComponentTest.php +++ b/tests/TestCase/Controller/Component/SecurityComponentTest.php @@ -212,7 +212,7 @@ public function validatePost($expectedException = null, $expectedExceptionMessag */ public function testBlackholeWithBrokenCallback() { - $this->expectException(\Cake\Network\Exception\BadRequestException::class); + $this->expectException(\Cake\Http\Exception\BadRequestException::class); $request = new ServerRequest([ 'url' => 'posts/index', 'session' => $this->Security->session diff --git a/tests/TestCase/Error/ErrorHandlerTest.php b/tests/TestCase/Error/ErrorHandlerTest.php index 14e3c47d56c..f301456e5cb 100644 --- a/tests/TestCase/Error/ErrorHandlerTest.php +++ b/tests/TestCase/Error/ErrorHandlerTest.php @@ -18,10 +18,10 @@ use Cake\Core\Plugin; use Cake\Error\ErrorHandler; use Cake\Error\PHP7ErrorException; +use Cake\Http\Exception\ForbiddenException; +use Cake\Http\Exception\NotFoundException; use Cake\Http\ServerRequest; use Cake\Log\Log; -use Cake\Network\Exception\ForbiddenException; -use Cake\Network\Exception\NotFoundException; use Cake\Routing\Exception\MissingControllerException; use Cake\Routing\Router; use Cake\TestSuite\TestCase; @@ -282,14 +282,14 @@ public function testHandleExceptionLog() $this->_logger->expects($this->at(0)) ->method('log') ->with('error', $this->logicalAnd( - $this->stringContains('[Cake\Network\Exception\NotFoundException] Kaboom!'), + $this->stringContains('[Cake\Http\Exception\NotFoundException] Kaboom!'), $this->stringContains('ErrorHandlerTest->testHandleExceptionLog') )); $this->_logger->expects($this->at(1)) ->method('log') ->with('error', $this->logicalAnd( - $this->stringContains('[Cake\Network\Exception\NotFoundException] Kaboom!'), + $this->stringContains('[Cake\Http\Exception\NotFoundException] Kaboom!'), $this->logicalNot($this->stringContains('ErrorHandlerTest->testHandleExceptionLog')) )); @@ -358,12 +358,12 @@ public function testHandleExceptionLogSkipping() ->method('log') ->with( 'error', - $this->stringContains('[Cake\Network\Exception\ForbiddenException] Fooled you!') + $this->stringContains('[Cake\Http\Exception\ForbiddenException] Fooled you!') ); $errorHandler = new TestErrorHandler([ 'log' => true, - 'skipLog' => ['Cake\Network\Exception\NotFoundException'], + 'skipLog' => ['Cake\Http\Exception\NotFoundException'], ]); $errorHandler->handleException($notFound); diff --git a/tests/TestCase/Error/ExceptionRendererTest.php b/tests/TestCase/Error/ExceptionRendererTest.php index 87e833ea82c..a3b6e69bb7f 100644 --- a/tests/TestCase/Error/ExceptionRendererTest.php +++ b/tests/TestCase/Error/ExceptionRendererTest.php @@ -27,11 +27,11 @@ use Cake\Error\ExceptionRenderer; use Cake\Event\Event; use Cake\Event\EventManager; +use Cake\Http\Exception\InternalErrorException; +use Cake\Http\Exception\MethodNotAllowedException; +use Cake\Http\Exception\NotFoundException; use Cake\Http\ServerRequest; use Cake\Mailer\Exception\MissingActionException as MissingMailerActionException; -use Cake\Network\Exception\InternalErrorException; -use Cake\Network\Exception\MethodNotAllowedException; -use Cake\Network\Exception\NotFoundException; use Cake\Network\Exception\SocketException; use Cake\ORM\Exception\MissingBehaviorException; use Cake\Routing\DispatcherFactory; diff --git a/tests/TestCase/Error/Middleware/ErrorHandlerMiddlewareTest.php b/tests/TestCase/Error/Middleware/ErrorHandlerMiddlewareTest.php index 7a89dde0920..fd25933d0d0 100644 --- a/tests/TestCase/Error/Middleware/ErrorHandlerMiddlewareTest.php +++ b/tests/TestCase/Error/Middleware/ErrorHandlerMiddlewareTest.php @@ -136,7 +136,7 @@ public function testHandleException() $response = new Response(); $middleware = new ErrorHandlerMiddleware(); $next = function ($req, $res) { - throw new \Cake\Network\Exception\NotFoundException('whoops'); + throw new \Cake\Http\Exception\NotFoundException('whoops'); }; $result = $middleware($request, $response, $next); $this->assertInstanceOf('Psr\Http\Message\ResponseInterface', $result); @@ -156,7 +156,7 @@ public function testHandleExceptionLogAndTrace() $this->logger->expects($this->at(0)) ->method('log') ->with('error', $this->logicalAnd( - $this->stringContains('[Cake\Network\Exception\NotFoundException] Kaboom!'), + $this->stringContains('[Cake\Http\Exception\NotFoundException] Kaboom!'), $this->stringContains('ErrorHandlerMiddlewareTest->testHandleException'), $this->stringContains('Request URL: /target/url'), $this->stringContains('Referer URL: /other/path') @@ -169,7 +169,7 @@ public function testHandleExceptionLogAndTrace() $response = new Response(); $middleware = new ErrorHandlerMiddleware(null, ['log' => true, 'trace' => true]); $next = function ($req, $res) { - throw new \Cake\Network\Exception\NotFoundException('Kaboom!'); + throw new \Cake\Http\Exception\NotFoundException('Kaboom!'); }; $result = $middleware($request, $response, $next); $this->assertNotSame($result, $response); @@ -190,10 +190,10 @@ public function testHandleExceptionSkipLog() $response = new Response(); $middleware = new ErrorHandlerMiddleware(null, [ 'log' => true, - 'skipLog' => ['Cake\Network\Exception\NotFoundException'] + 'skipLog' => ['Cake\Http\Exception\NotFoundException'] ]); $next = function ($req, $res) { - throw new \Cake\Network\Exception\NotFoundException('Kaboom!'); + throw new \Cake\Http\Exception\NotFoundException('Kaboom!'); }; $result = $middleware($request, $response, $next); $this->assertNotSame($result, $response); @@ -253,7 +253,7 @@ public function testHandleExceptionRenderingFails() }; $middleware = new ErrorHandlerMiddleware($factory); $next = function ($req, $res) { - throw new \Cake\Network\Exception\ServiceUnavailableException('whoops'); + throw new \Cake\Http\Exception\ServiceUnavailableException('whoops'); }; $response = $middleware($request, $response, $next); $this->assertEquals(500, $response->getStatusCode()); diff --git a/tests/TestCase/ExceptionsTest.php b/tests/TestCase/ExceptionsTest.php index 37578de9c07..97f3f136271 100644 --- a/tests/TestCase/ExceptionsTest.php +++ b/tests/TestCase/ExceptionsTest.php @@ -149,21 +149,21 @@ public function exceptionProvider() ['Cake\Datasource\Exception\RecordNotFoundException', 404], ['Cake\Mailer\Exception\MissingActionException', 404], ['Cake\Mailer\Exception\MissingMailerException', 500], - ['Cake\Network\Exception\BadRequestException', 400], - ['Cake\Network\Exception\ConflictException', 409], - ['Cake\Network\Exception\ForbiddenException', 403], - ['Cake\Network\Exception\GoneException', 410], - ['Cake\Network\Exception\HttpException', 500], - ['Cake\Network\Exception\InternalErrorException', 500], - ['Cake\Network\Exception\InvalidCsrfTokenException', 403], - ['Cake\Network\Exception\MethodNotAllowedException', 405], - ['Cake\Network\Exception\NotAcceptableException', 406], - ['Cake\Network\Exception\NotFoundException', 404], - ['Cake\Network\Exception\NotImplementedException', 501], - ['Cake\Network\Exception\ServiceUnavailableException', 503], + ['Cake\Http\Exception\BadRequestException', 400], + ['Cake\Http\Exception\ConflictException', 409], + ['Cake\Http\Exception\ForbiddenException', 403], + ['Cake\Http\Exception\GoneException', 410], + ['Cake\Http\Exception\HttpException', 500], + ['Cake\Http\Exception\InternalErrorException', 500], + ['Cake\Http\Exception\InvalidCsrfTokenException', 403], + ['Cake\Http\Exception\MethodNotAllowedException', 405], + ['Cake\Http\Exception\NotAcceptableException', 406], + ['Cake\Http\Exception\NotFoundException', 404], + ['Cake\Http\Exception\NotImplementedException', 501], + ['Cake\Http\Exception\ServiceUnavailableException', 503], + ['Cake\Http\Exception\UnauthorizedException', 401], + ['Cake\Http\Exception\UnavailableForLegalReasonsException', 451], ['Cake\Network\Exception\SocketException', 0], - ['Cake\Network\Exception\UnauthorizedException', 401], - ['Cake\Network\Exception\UnavailableForLegalReasonsException', 451], ['Cake\ORM\Exception\MissingBehaviorException', 500], ['Cake\ORM\Exception\MissingEntityException', 500], ['Cake\ORM\Exception\MissingTableClassException', 500], diff --git a/tests/TestCase/Http/Client/Adapter/StreamTest.php b/tests/TestCase/Http/Client/Adapter/StreamTest.php index 0ecea1aa0b0..2096e9222a0 100644 --- a/tests/TestCase/Http/Client/Adapter/StreamTest.php +++ b/tests/TestCase/Http/Client/Adapter/StreamTest.php @@ -421,7 +421,7 @@ public function testKeepDeadline() */ public function testMissDeadline() { - $this->expectException(\Cake\Network\Exception\HttpException::class); + $this->expectException(\Cake\Http\Exception\HttpException::class); $this->expectExceptionMessage('Connection timed out http://dummy/?sleep'); $request = new Request('http://dummy/?sleep'); $options = [ diff --git a/tests/TestCase/Http/Middleware/CsrfProtectionMiddlewareTest.php b/tests/TestCase/Http/Middleware/CsrfProtectionMiddlewareTest.php index 708ebe6ee24..5749b5e3929 100644 --- a/tests/TestCase/Http/Middleware/CsrfProtectionMiddlewareTest.php +++ b/tests/TestCase/Http/Middleware/CsrfProtectionMiddlewareTest.php @@ -146,7 +146,7 @@ public function testValidTokenInHeader($method) */ public function testInvalidTokenInHeader($method) { - $this->expectException(\Cake\Network\Exception\InvalidCsrfTokenException::class); + $this->expectException(\Cake\Http\Exception\InvalidCsrfTokenException::class); $request = new ServerRequest([ 'environment' => [ 'REQUEST_METHOD' => $method, @@ -195,7 +195,7 @@ public function testValidTokenRequestData($method) */ public function testInvalidTokenRequestData($method) { - $this->expectException(\Cake\Network\Exception\InvalidCsrfTokenException::class); + $this->expectException(\Cake\Http\Exception\InvalidCsrfTokenException::class); $request = new ServerRequest([ 'environment' => [ 'REQUEST_METHOD' => $method, @@ -216,7 +216,7 @@ public function testInvalidTokenRequestData($method) */ public function testInvalidTokenRequestDataMissing() { - $this->expectException(\Cake\Network\Exception\InvalidCsrfTokenException::class); + $this->expectException(\Cake\Http\Exception\InvalidCsrfTokenException::class); $request = new ServerRequest([ 'environment' => [ 'REQUEST_METHOD' => 'POST', @@ -238,7 +238,7 @@ public function testInvalidTokenRequestDataMissing() */ public function testInvalidTokenMissingCookie($method) { - $this->expectException(\Cake\Network\Exception\InvalidCsrfTokenException::class); + $this->expectException(\Cake\Http\Exception\InvalidCsrfTokenException::class); $request = new ServerRequest([ 'environment' => [ 'REQUEST_METHOD' => $method diff --git a/tests/TestCase/Http/ResponseTest.php b/tests/TestCase/Http/ResponseTest.php index 43269692627..de4c8b5c6fb 100644 --- a/tests/TestCase/Http/ResponseTest.php +++ b/tests/TestCase/Http/ResponseTest.php @@ -18,10 +18,10 @@ use Cake\Http\Cookie\Cookie; use Cake\Http\Cookie\CookieCollection; +use Cake\Http\Exception\NotFoundException; use Cake\Http\Response; use Cake\Http\ServerRequest; use Cake\Network\CorsBuilder; -use Cake\Network\Exception\NotFoundException; use Cake\TestSuite\TestCase; use Zend\Diactoros\Stream; @@ -1864,7 +1864,7 @@ public function corsData() */ public function testFileNotFound() { - $this->expectException(\Cake\Network\Exception\NotFoundException::class); + $this->expectException(\Cake\Http\Exception\NotFoundException::class); $this->deprecated(function () { $response = new Response(); $response->file('/some/missing/folder/file.jpg'); @@ -1878,7 +1878,7 @@ public function testFileNotFound() */ public function testWithFileNotFound() { - $this->expectException(\Cake\Network\Exception\NotFoundException::class); + $this->expectException(\Cake\Http\Exception\NotFoundException::class); $response = new Response(); $response->withFile('/some/missing/folder/file.jpg'); } diff --git a/tests/TestCase/Http/ServerRequestTest.php b/tests/TestCase/Http/ServerRequestTest.php index 26dc8c2c79e..d0b2838db6d 100644 --- a/tests/TestCase/Http/ServerRequestTest.php +++ b/tests/TestCase/Http/ServerRequestTest.php @@ -17,9 +17,9 @@ use Cake\Core\Configure; use Cake\Http\Cookie\Cookie; use Cake\Http\Cookie\CookieCollection; +use Cake\Http\Exception\MethodNotAllowedException; use Cake\Http\ServerRequest; use Cake\Http\ServerRequestFactory; -use Cake\Network\Exception\MethodNotAllowedException; use Cake\Network\Session; use Cake\TestSuite\TestCase; use Zend\Diactoros\UploadedFile; diff --git a/tests/test_app/TestApp/Controller/PagesController.php b/tests/test_app/TestApp/Controller/PagesController.php index 6cbe0bd913f..930dc0247c0 100644 --- a/tests/test_app/TestApp/Controller/PagesController.php +++ b/tests/test_app/TestApp/Controller/PagesController.php @@ -19,7 +19,7 @@ namespace TestApp\Controller; use Cake\Core\Configure; -use Cake\Network\Exception\NotFoundException; +use Cake\Http\Exception\NotFoundException; use Cake\Utility\Inflector; use Cake\View\Exception\MissingTemplateException; @@ -45,7 +45,7 @@ class PagesController extends AppController * * @param mixed What page to display * @return \Cake\Http\Response|null - * @throws \Cake\Network\Exception\NotFoundException When the view file could not be found + * @throws \Cake\Http\Exception\NotFoundException When the view file could not be found * or Cake\View\Exception\MissingTemplateException in debug mode. */ public function display() diff --git a/tests/test_app/TestApp/Controller/RequestActionController.php b/tests/test_app/TestApp/Controller/RequestActionController.php index e546f5433c8..993fda20970 100644 --- a/tests/test_app/TestApp/Controller/RequestActionController.php +++ b/tests/test_app/TestApp/Controller/RequestActionController.php @@ -13,7 +13,7 @@ */ namespace TestApp\Controller; -use Cake\Network\Exception\NotFoundException; +use Cake\Http\Exception\NotFoundException; /** * RequestActionController class @@ -170,7 +170,7 @@ public function input_test() /** * Tests exception handling * - * @throws \Cake\Network\Exception\NotFoundException + * @throws \Cake\Http\Exception\NotFoundException * @return void */ public function error_method()