Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for debugOutput() #7943

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions en/appendices/5-2-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 comands.
markstory marked this conversation as resolved.
Show resolved Hide resolved

ORM
---
Expand Down
18 changes: 14 additions & 4 deletions en/console-commands/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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**::

Expand Down Expand Up @@ -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
===================

Expand Down
2 changes: 1 addition & 1 deletion en/console-commands/schema-cache.rst
Original file line number Diff line number Diff line change
@@ -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:
Expand Down