diff --git a/en/appendices/5-2-migration-guide.rst b/en/appendices/5-2-migration-guide.rst index 69a6d9760b..92ce571d86 100644 --- a/en/appendices/5-2-migration-guide.rst +++ b/en/appendices/5-2-migration-guide.rst @@ -22,6 +22,8 @@ Console - The ``cake counter_cache`` command was added. This command can be used to regenerate counters for models that use ``CounterCacheBehavior``. +- ``ConsoleIntegrationTestTrait::debugOutput()`` makes it easier to debug + integration tests for console commands. ORM --- diff --git a/en/console-commands/commands.rst b/en/console-commands/commands.rst index 429a048f22..9493a24b5c 100644 --- a/en/console-commands/commands.rst +++ b/en/console-commands/commands.rst @@ -298,10 +298,6 @@ To get started testing your console application, create a test case that uses th ``exec()`` that is used to execute your command. You can pass the same string you would use in the CLI to this method. -.. note:: - - For CakePHP 4.4 onwards the ``Cake\Console\TestSuite\ConsoleIntegrationTestTrait`` namespace should be used. - Let's start with a very simple command, located in **src/Command/UpdateTableCommand.php**:: @@ -549,6 +545,20 @@ assertion methods that make help assert against console output:: // assert that stderr matches a regular expression $this->assertErrorRegExp($expected); +Debug Helpers +------------- + +You can use ``debugOutput()`` to output the exit code, stdout and stderr of the +last run command:: + + $this->exec('update_table Users'); + $this->assertExitCode(Command::CODE_SUCCESS); + $this->debugOutput(); + +.. versionadded:: 4.2.0 + The ``debugOutput()`` method was added. + + Lifecycle Callbacks =================== diff --git a/en/console-commands/schema-cache.rst b/en/console-commands/schema-cache.rst index 90a24b690a..df891ab6a5 100644 --- a/en/console-commands/schema-cache.rst +++ b/en/console-commands/schema-cache.rst @@ -1,7 +1,7 @@ Schema Cache Tool ################# -The SchemaCacheShell provides a simple CLI tool for managing your application's +The SchemaCacheCommand provides a simple CLI tool for managing your application's metadata caches. In deployment situations it is helpful to rebuild the metadata cache in-place without clearing the existing cache data. You can do this by running: