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

Update commands.rst #5744

Merged
merged 2 commits into from May 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions en/console-and-shells/commands.rst
Expand Up @@ -211,16 +211,16 @@ To get started testing your console application, create a test case that extends
you would use in the CLI to this method.

Let's start with a very simple command, located in
**src/Shell/UpdatTableCommand.php**::
**src/Command/UpdateTableCommand.php**::

namespace App\Command;

use Cake\Console\Arguments;
use Cake\Console\Command;
use Cake\Console\ConsoleIo;
use Cake\Console\ConsoleOptionParser;
use Cake\Console\Command;

class UpdateTableCommand extends Shell
class UpdateTableCommand extends Command
{
public function buildOptionParser(ConsoleOptionParser $parser)
{
Expand All @@ -231,7 +231,7 @@ Let's start with a very simple command, located in
}

To write an integration test for this shell, we would create a test case in
**tests/TestCase/Command/UpdateTableTest.php** that extends
**tests/TestCase/Command/UpdateTableCommandTest.php** that extends
``Cake\TestSuite\ConsoleIntegrationTestCase``. This shell doesn't do much at the
moment, but let's just test that our shell's description is displayed in ``stdout``::

Expand Down Expand Up @@ -261,9 +261,9 @@ adding more logic to our command::
namespace App\Command;

use Cake\Console\Arguments;
use Cake\Console\Command;
use Cake\Console\ConsoleIo;
use Cake\Console\ConsoleOptionParser;
use Cake\Console\Command;
use Cake\I18n\FrozenTime;

class UpdateTableCommand extends Command
Expand Down Expand Up @@ -324,7 +324,7 @@ Modify your test case to the following snippet of code::
$this->loadFixtures('Users');

$this->exec('update_table Users');
$this->assertExitCode(Shell::CODE_SUCCESS);
$this->assertExitCode(Command::CODE_SUCCESS);

$user = TableRegistry::get('Users')->get(1);
$this->assertSame($user->modified->timestamp, $now->timestamp);
Expand Down Expand Up @@ -355,8 +355,8 @@ Update the command class to the following::

namespace App\Command;

use Cake\Console\Command;
use Cake\Console\ConsoleOptionParser;
use Cake\Console\Shell;
use Cake\I18n\FrozenTime;

class UpdateTableCommand extends Command
Expand Down Expand Up @@ -393,7 +393,7 @@ Update the command class to the following::
Now that we have an interactive subcommand, we can add a test case that tests
that we receive the proper response, and one that tests that we receive an
incorrect response. Remove the ``testUpdateModifed`` mehod and, add the following methods to
**tests/TestCase/Shell/UpdateTableCommandTest.php**::
**tests/TestCase/Command/UpdateTableCommandTest.php**::


public function testUpdateModifiedSure()
Expand Down