diff --git a/en/appendices/3-5-migration-guide.rst b/en/appendices/3-5-migration-guide.rst index 018466cdd8..1375194ef9 100644 --- a/en/appendices/3-5-migration-guide.rst +++ b/en/appendices/3-5-migration-guide.rst @@ -24,6 +24,8 @@ features will continue to function until 4.0.0 after which they will be removed. :ref:`csrf-middleware` instead. * ``Cake\Datasource\TableSchemaInterface`` is deprecated. Use ``Cake\Database\TableSchemaAwareInterface`` instead. +* ``Cake\Console\ShellDispatcher`` is deprecated. Applications should update to + use ``Cake\Console\CommandRunner`` instead. Deprecated Combined Get/Set Methods ----------------------------------- @@ -146,6 +148,10 @@ Console * ``Cake\Console\ConsoleOptionParser::setHelpAlias()`` was added. This method allows you to set the command name used when generating help output. Defaults to ``cake``. +* ``Cake\Console\CommandRunnner`` was added replacing + ``Cake\Console\ShellDispatcher``. +* ``Cake\Console\CommandCollection`` was added to provide an interface for + applications to define the command line tools they offer. Datasource ---------- @@ -211,6 +217,8 @@ TestSuite * ``IntegrationTestCase::head()`` was added. * ``IntegrationTestCase::options()`` was added. +* ``IntegrationTestCase::disableErrorHandlerMiddleware()`` was added to make + debugging errors easier in integration tests. Validation ---------- diff --git a/en/development/testing.rst b/en/development/testing.rst index 717a4261e5..e0b0d8b318 100644 --- a/en/development/testing.rst +++ b/en/development/testing.rst @@ -914,12 +914,17 @@ methods to send a request: * ``put()`` Sends a PUT request. * ``delete()`` Sends a DELETE request. * ``patch()`` Sends a PATCH request. +* ``options()`` Sends an OPTIONS request. +* ``head()`` Sends a HEAD request. All of the methods except ``get()`` and ``delete()`` accept a second parameter that allows you to send a request body. After dispatching a request you can use the various assertions provided by ``IntegrationTestCase`` or PHPUnit to ensure your request had the correct side-effects. +.. versionadded:: 3.5.0 + ``options()`` and ``head()`` were added in 3.5.0. + Setting up the Request ---------------------- @@ -1169,6 +1174,26 @@ and make sure our web service is returning the proper response:: We use the ``JSON_PRETTY_PRINT`` option as CakePHP's built in JsonView will use that option when ``debug`` is enabled. +Disabling Error Handling Middleware in Tests +-------------------------------------------- + +When debugging tests that are failing because your application is encountering +errors it can be helpful to temporarily disable the error handling middleware to +allow the underlying error to bubble up. You can use +``disableErrorHandlerMiddleware()`` to do this:: + + public function testGetMissing() + { + $this->disableErrorHandlerMiddleware(); + $this->get('/markers/not-there'); + $this->assertResponseCode(404); + } + +In the above example, the test would fail and the underlying exception message +and stack trace would be displayed instead of the rendered error page being +checked. + +.. versionadded:: 3.5.0 Assertion methods -----------------