Browse Source

adjust command code references to use interface instead of implementing class

Kevin Pfeifer 4 years ago
parent
commit
47d5ecbf4a

+ 2 - 2
src/Error/ConsoleErrorHandler.php

@@ -16,7 +16,7 @@ declare(strict_types=1);
  */
 namespace Cake\Error;
 
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\Console\ConsoleOutput;
 use Cake\Console\Exception\ConsoleException;
 use Throwable;
@@ -64,7 +64,7 @@ class ConsoleErrorHandler extends BaseErrorHandler
         $this->_displayException($exception);
         $this->logException($exception);
 
-        $exitCode = Command::CODE_ERROR;
+        $exitCode = CommandInterface::CODE_ERROR;
         if ($exception instanceof ConsoleException) {
             $exitCode = $exception->getCode();
         }

+ 5 - 5
src/TestSuite/ConsoleIntegrationTestTrait.php

@@ -15,7 +15,7 @@ declare(strict_types=1);
  */
 namespace Cake\TestSuite;
 
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\Console\CommandRunner;
 use Cake\Console\ConsoleInput;
 use Cake\Console\ConsoleIo;
@@ -139,25 +139,25 @@ trait ConsoleIntegrationTestTrait
     }
 
     /**
-     * Asserts shell exited with the Command::CODE_SUCCESS
+     * Asserts shell exited with the CommandInterface::CODE_SUCCESS
      *
      * @param string $message Failure message
      * @return void
      */
     public function assertExitSuccess(string $message = ''): void
     {
-        $this->assertThat(Command::CODE_SUCCESS, new ExitCode($this->_exitCode), $message);
+        $this->assertThat(CommandInterface::CODE_SUCCESS, new ExitCode($this->_exitCode), $message);
     }
 
     /**
-     * Asserts shell exited with Command::CODE_ERROR
+     * Asserts shell exited with CommandInterface::CODE_ERROR
      *
      * @param string $message Failure message
      * @return void
      */
     public function assertExitError(string $message = ''): void
     {
-        $this->assertThat(Command::CODE_ERROR, new ExitCode($this->_exitCode), $message);
+        $this->assertThat(CommandInterface::CODE_ERROR, new ExitCode($this->_exitCode), $message);
     }
 
     /**

+ 9 - 9
tests/TestCase/Command/CacheCommandsTest.php

@@ -17,7 +17,7 @@ declare(strict_types=1);
 namespace Cake\Test\TestCase\Command;
 
 use Cake\Cache\Cache;
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
 use Cake\TestSuite\TestCase;
 
@@ -54,7 +54,7 @@ class CacheCommandsTest extends TestCase
     {
         $this->exec('cache clear -h');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('engine to clear');
     }
 
@@ -65,7 +65,7 @@ class CacheCommandsTest extends TestCase
     {
         $this->exec('cache clear_all -h');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('Clear all');
     }
 
@@ -76,7 +76,7 @@ class CacheCommandsTest extends TestCase
     {
         $this->exec('cache list');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('- test');
         $this->assertOutputContains('- _cake_core_');
         $this->assertOutputContains('- _cake_model_');
@@ -89,7 +89,7 @@ class CacheCommandsTest extends TestCase
     {
         $this->exec('cache list -h');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('Show a list');
     }
 
@@ -99,7 +99,7 @@ class CacheCommandsTest extends TestCase
     public function testClearInvalidPrefix(): void
     {
         $this->exec('cache clear foo');
-        $this->assertExitCode(Command::CODE_ERROR);
+        $this->assertExitCode(CommandInterface::CODE_ERROR);
         $this->assertErrorContains('The "foo" cache configuration does not exist');
     }
 
@@ -111,7 +111,7 @@ class CacheCommandsTest extends TestCase
         Cache::add('key', 'value', 'test');
         $this->exec('cache clear test');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertNull(Cache::read('key', 'test'));
     }
 
@@ -123,7 +123,7 @@ class CacheCommandsTest extends TestCase
         Cache::add('key', 'value', 'test');
         $this->exec('cache clear _cake_core_');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertSame('value', Cache::read('key', 'test'));
     }
 
@@ -136,7 +136,7 @@ class CacheCommandsTest extends TestCase
         Cache::add('key', 'value3', '_cake_core_');
         $this->exec('cache clear_all');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertNull(Cache::read('key', 'test'));
         $this->assertNull(Cache::read('key', '_cake_core_'));
     }

+ 19 - 19
tests/TestCase/Command/CompletionCommandTest.php

@@ -16,7 +16,7 @@ declare(strict_types=1);
  */
 namespace Cake\Test\TestCase\Command;
 
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\Core\Configure;
 use Cake\Routing\Router;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
@@ -55,7 +55,7 @@ class CompletionCommandTest extends TestCase
     public function testStartup(): void
     {
         $this->exec('completion');
-        $this->assertExitCode(Command::CODE_ERROR);
+        $this->assertExitCode(CommandInterface::CODE_ERROR);
 
         $this->assertOutputNotContains('Welcome to CakePHP');
     }
@@ -66,7 +66,7 @@ class CompletionCommandTest extends TestCase
     public function testCommands(): void
     {
         $this->exec('completion commands');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = [
             'test_plugin.example',
@@ -99,7 +99,7 @@ class CompletionCommandTest extends TestCase
     public function testOptionsNoArguments(): void
     {
         $this->exec('completion options');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputEmpty();
     }
 
@@ -109,7 +109,7 @@ class CompletionCommandTest extends TestCase
     public function testOptionsNonExistentCommand(): void
     {
         $this->exec('completion options foo');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputEmpty();
     }
 
@@ -119,7 +119,7 @@ class CompletionCommandTest extends TestCase
     public function testOptionsCommand(): void
     {
         $this->exec('completion options schema_cache');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = [
             '--connection -c',
@@ -138,7 +138,7 @@ class CompletionCommandTest extends TestCase
     public function testOptionsSubCommand(): void
     {
         $this->exec('completion options cache list');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = [
             '--help -h',
@@ -156,7 +156,7 @@ class CompletionCommandTest extends TestCase
     public function testOptionsNestedCommand(): void
     {
         $this->exec('completion options i18n extract');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = [
             '--plugin',
@@ -173,7 +173,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommandsCorePlugin(): void
     {
         $this->exec('completion subcommands schema_cache');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = 'build clear';
         $this->assertOutputContains($expected);
@@ -185,7 +185,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommandsAppPlugin(): void
     {
         $this->exec('completion subcommands sample');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('sub');
     }
 
@@ -195,7 +195,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommandsCoreMultiwordCommand(): void
     {
         $this->exec('completion subcommands cache');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = [
             'list', 'clear', 'clear_all',
@@ -212,7 +212,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommandsPlugin(): void
     {
         $this->exec('completion subcommands welcome');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = 'say_hello';
         $this->assertOutputContains($expected);
@@ -224,7 +224,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommandsPluginDotNotationBackwardCompatibility(): void
     {
         $this->exec('completion subcommands test_plugin_two.welcome');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = 'say_hello';
         $this->assertOutputContains($expected);
@@ -237,7 +237,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommandsAppDuplicatePluginNoDot(): void
     {
         $this->exec('completion subcommands sample');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('sub');
     }
 
@@ -247,7 +247,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommandsPluginDuplicateApp(): void
     {
         $this->exec('completion subcommands test_plugin.sample');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = 'sub';
         $this->assertOutputContains($expected);
@@ -259,7 +259,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommandsNoArguments(): void
     {
         $this->exec('completion subcommands');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $this->assertOutputEmpty();
     }
@@ -270,7 +270,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommandsNonExistentCommand(): void
     {
         $this->exec('completion subcommands foo');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $this->assertOutputEmpty();
     }
@@ -281,7 +281,7 @@ class CompletionCommandTest extends TestCase
     public function testSubCommands(): void
     {
         $this->exec('completion subcommands schema_cache');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $expected = 'build clear';
         $this->assertOutputContains($expected);
@@ -302,7 +302,7 @@ class CompletionCommandTest extends TestCase
     public function testHelp(): void
     {
         $this->exec('completion --help');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $this->assertOutputContains('Output a list of available commands');
         $this->assertOutputContains('Output a list of available sub-commands');

+ 3 - 3
tests/TestCase/Command/PluginAssetsCommandsTest.php

@@ -16,7 +16,7 @@ declare(strict_types=1);
  */
 namespace Cake\Test\TestCase\Command;
 
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\Console\ConsoleIo;
 use Cake\Console\ConsoleOptionParser;
 use Cake\Core\Configure;
@@ -78,7 +78,7 @@ class PluginAssetsCommandsTest extends TestCase
         $this->loadPlugins(['TestPlugin' => ['routes' => false], 'Company/TestPluginThree']);
 
         $this->exec('plugin assets symlink');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $path = $this->wwwRoot . 'test_plugin';
         $this->assertFileExists($path . DS . 'root.js');
@@ -96,7 +96,7 @@ class PluginAssetsCommandsTest extends TestCase
         mkdir($this->wwwRoot . 'company');
 
         $this->exec('plugin assets symlink');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $path = $this->wwwRoot . 'company' . DS . 'test_plugin_three';
         $this->assertFileExists($path . DS . 'css' . DS . 'company.css');

+ 4 - 4
tests/TestCase/Command/PluginLoadCommandTest.php

@@ -15,7 +15,7 @@ declare(strict_types=1);
  */
 namespace Cake\Test\TestCase\Command;
 
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
 use Cake\TestSuite\TestCase;
 
@@ -65,7 +65,7 @@ class PluginLoadCommandTest extends TestCase
     public function testHelp(): void
     {
         $this->exec('plugin load --help');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('plugin load');
     }
 
@@ -75,7 +75,7 @@ class PluginLoadCommandTest extends TestCase
     public function testLoadModifiesApplication(): void
     {
         $this->exec('plugin load TestPlugin');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $contents = file_get_contents($this->app);
         $this->assertMatchesRegularExpression('/Check plugins added here\n {8}\$this->addPlugin\(\'TestPlugin\'\);\n {4}\}\n/u', $contents);
@@ -87,7 +87,7 @@ class PluginLoadCommandTest extends TestCase
     public function testLoadUnknownPlugin(): void
     {
         $this->exec('plugin load NopeNotThere');
-        $this->assertExitCode(Command::CODE_ERROR);
+        $this->assertExitCode(CommandInterface::CODE_ERROR);
         $this->assertErrorContains('Plugin NopeNotThere could not be found');
 
         $contents = file_get_contents($this->app);

+ 2 - 1
tests/TestCase/Command/PluginLoadedCommandTest.php

@@ -17,6 +17,7 @@ declare(strict_types=1);
 namespace Cake\Test\TestCase\Command;
 
 use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\Core\Plugin;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
 use Cake\TestSuite\TestCase;
@@ -46,7 +47,7 @@ class PluginLoadedCommandTest extends TestCase
         $expected = Plugin::loaded();
 
         $this->exec('plugin loaded');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         foreach ($expected as $value) {
             $this->assertOutputContains($value);

+ 4 - 4
tests/TestCase/Command/PluginUnloadCommandTest.php

@@ -15,7 +15,7 @@ declare(strict_types=1);
  */
 namespace Cake\Test\TestCase\Command;
 
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
 use Cake\TestSuite\TestCase;
 
@@ -71,7 +71,7 @@ class PluginUnloadCommandTest extends TestCase
         $this->addPluginToApp($plugin2);
         $this->exec('plugin unload TestPlugin');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $contents = file_get_contents($this->app);
 
         $this->assertStringNotContainsString($plugin1, $contents);
@@ -89,7 +89,7 @@ class PluginUnloadCommandTest extends TestCase
         $this->addPluginToApp($plugin2);
         $this->exec('plugin unload Vendor/TestPluginTwo');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $contents = file_get_contents($this->app);
 
         $this->assertStringNotContainsString($plugin2, $contents);
@@ -162,7 +162,7 @@ class PluginUnloadCommandTest extends TestCase
         $this->addPluginToApp($content);
 
         $this->exec('plugin unload TestPlugin');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
 
         $result = file_get_contents($this->app);
 

+ 17 - 17
tests/TestCase/Command/RoutesCommandTest.php

@@ -16,7 +16,7 @@ declare(strict_types=1);
  */
 namespace Cake\Test\TestCase\Command;
 
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\Routing\Route\Route;
 use Cake\Routing\Router;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
@@ -53,7 +53,7 @@ class RoutesCommandTest extends TestCase
     public function testRouteListHelp(): void
     {
         $this->exec('routes -h');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('list of routes');
         $this->assertErrorEmpty();
     }
@@ -64,7 +64,7 @@ class RoutesCommandTest extends TestCase
     public function testRouteList(): void
     {
         $this->exec('routes');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContainsRow([
             '<info>Route name</info>',
             '<info>URI template</info>',
@@ -109,7 +109,7 @@ class RoutesCommandTest extends TestCase
     public function testRouteListVerbose(): void
     {
         $this->exec('routes -v');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContainsRow([
             '<info>Route name</info>',
             '<info>URI template</info>',
@@ -142,7 +142,7 @@ class RoutesCommandTest extends TestCase
         );
 
         $this->exec('routes -s');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('_aRoute', $this->_out->messages()[3]);
     }
 
@@ -152,7 +152,7 @@ class RoutesCommandTest extends TestCase
     public function testCheckHelp(): void
     {
         $this->exec('routes check -h');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('Check a URL');
         $this->assertErrorEmpty();
     }
@@ -163,7 +163,7 @@ class RoutesCommandTest extends TestCase
     public function testCheckNoInput(): void
     {
         $this->exec('routes check');
-        $this->assertExitCode(Command::CODE_ERROR);
+        $this->assertExitCode(CommandInterface::CODE_ERROR);
         $this->assertErrorContains('`url` argument is required');
     }
 
@@ -173,7 +173,7 @@ class RoutesCommandTest extends TestCase
     public function testCheck(): void
     {
         $this->exec('routes check /app/articles/check');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContainsRow([
             '<info>Route name</info>',
             '<info>URI template</info>',
@@ -192,7 +192,7 @@ class RoutesCommandTest extends TestCase
     public function testCheckWithNamedRoute(): void
     {
         $this->exec('routes check /app/tests/index');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContainsRow([
             '<info>Route name</info>',
             '<info>URI template</info>',
@@ -211,7 +211,7 @@ class RoutesCommandTest extends TestCase
     public function testCheckWithRedirectRoute(): void
     {
         $this->exec('routes check /app/redirect');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContainsRow([
             '<info>URI template</info>',
             '<info>Redirect</info>',
@@ -228,7 +228,7 @@ class RoutesCommandTest extends TestCase
     public function testCheckNotFound(): void
     {
         $this->exec('routes check /nope');
-        $this->assertExitCode(Command::CODE_ERROR);
+        $this->assertExitCode(CommandInterface::CODE_ERROR);
         $this->assertErrorContains('did not match');
     }
 
@@ -238,7 +238,7 @@ class RoutesCommandTest extends TestCase
     public function testGenerareHelp(): void
     {
         $this->exec('routes generate -h');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('Check a routing array');
         $this->assertErrorEmpty();
     }
@@ -249,7 +249,7 @@ class RoutesCommandTest extends TestCase
     public function testGenerateNoPassArgs(): void
     {
         $this->exec('routes generate controller:Articles action:index');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('> /app/articles');
         $this->assertErrorEmpty();
     }
@@ -260,7 +260,7 @@ class RoutesCommandTest extends TestCase
     public function testGeneratePassedArguments(): void
     {
         $this->exec('routes generate controller:Articles action:view 2 3');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('> /app/articles/view/2/3');
         $this->assertErrorEmpty();
     }
@@ -271,7 +271,7 @@ class RoutesCommandTest extends TestCase
     public function testGenerateBoolParams(): void
     {
         $this->exec('routes generate controller:Articles action:index _ssl:true _host:example.com');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('> https://example.com/app/articles');
     }
 
@@ -281,7 +281,7 @@ class RoutesCommandTest extends TestCase
     public function testGenerateMissing(): void
     {
         $this->exec('routes generate plugin:Derp controller:Derp');
-        $this->assertExitCode(Command::CODE_ERROR);
+        $this->assertExitCode(CommandInterface::CODE_ERROR);
         $this->assertErrorContains('do not match');
     }
 
@@ -299,7 +299,7 @@ class RoutesCommandTest extends TestCase
         );
 
         $this->exec('routes');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContainsRow([
             '<info>Route name</info>',
             '<info>URI template</info>',

+ 4 - 4
tests/TestCase/Console/Command/HelpCommandTest.php

@@ -16,7 +16,7 @@ declare(strict_types=1);
  */
 namespace Cake\Test\TestCase\Console\Command;
 
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\Core\Plugin;
 use Cake\Http\BaseApplication;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
@@ -60,7 +60,7 @@ class HelpCommandTest extends TestCase
     public function testMainNoCommandsFallback(): void
     {
         $this->exec('help');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertCommandList();
         $this->clearPlugins();
     }
@@ -71,7 +71,7 @@ class HelpCommandTest extends TestCase
     public function testMain(): void
     {
         $this->exec('help');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertCommandList();
     }
 
@@ -102,7 +102,7 @@ class HelpCommandTest extends TestCase
     public function testMainAsXml(): void
     {
         $this->exec('help --xml');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('<shells>');
 
         $find = '<shell name="sample" call_as="sample" provider="TestApp\Command\SampleCommand" help="sample -h"';

+ 9 - 9
tests/TestCase/Console/CommandRunnerTest.php

@@ -16,9 +16,9 @@ declare(strict_types=1);
  */
 namespace Cake\Test\TestCase\Console;
 
-use Cake\Command\Command;
 use Cake\Console\CommandCollection;
 use Cake\Console\CommandFactoryInterface;
+use Cake\Console\CommandInterface;
 use Cake\Console\CommandRunner;
 use Cake\Console\ConsoleIo;
 use Cake\Core\Configure;
@@ -275,7 +275,7 @@ class CommandRunnerTest extends TestCase
 
         $runner = new CommandRunner($app, 'cake');
         $result = $runner->run(['cake', 'routes'], $this->getMockIo($output));
-        $this->assertSame(Command::CODE_SUCCESS, $result);
+        $this->assertSame(CommandInterface::CODE_SUCCESS, $result);
 
         $contents = implode("\n", $output->messages());
         $this->assertStringContainsString('URI template', $contents);
@@ -296,7 +296,7 @@ class CommandRunnerTest extends TestCase
 
         $runner = new CommandRunner($app, 'cake');
         $result = $runner->run(['cake', 'schema_cache', 'build'], $this->getMockIo($output));
-        $this->assertSame(Command::CODE_SUCCESS, $result);
+        $this->assertSame(CommandInterface::CODE_SUCCESS, $result);
 
         $contents = implode("\n", $output->messages());
         $this->assertStringContainsString('Cache', $contents);
@@ -340,7 +340,7 @@ class CommandRunnerTest extends TestCase
 
         $runner = new CommandRunner($app, 'cake');
         $result = $runner->run(['cake', 'ex'], $this->getMockIo($output));
-        $this->assertSame(Command::CODE_SUCCESS, $result);
+        $this->assertSame(CommandInterface::CODE_SUCCESS, $result);
 
         $messages = implode("\n", $output->messages());
         $this->assertStringContainsString('Demo Command!', $messages);
@@ -359,7 +359,7 @@ class CommandRunnerTest extends TestCase
 
         $runner = new CommandRunner($app, 'cake');
         $result = $runner->run(['cake', 'tool', 'build'], $this->getMockIo($output));
-        $this->assertSame(Command::CODE_SUCCESS, $result);
+        $this->assertSame(CommandInterface::CODE_SUCCESS, $result);
 
         $messages = implode("\n", $output->messages());
         $this->assertStringContainsString('Demo Command!', $messages);
@@ -378,7 +378,7 @@ class CommandRunnerTest extends TestCase
 
         $runner = new CommandRunner($app, 'cake');
         $result = $runner->run(['cake', 'tool', 'build', 'assets'], $this->getMockIo($output));
-        $this->assertSame(Command::CODE_SUCCESS, $result);
+        $this->assertSame(CommandInterface::CODE_SUCCESS, $result);
 
         $messages = implode("\n", $output->messages());
         $this->assertStringContainsString('Demo Command!', $messages);
@@ -401,7 +401,7 @@ class CommandRunnerTest extends TestCase
 
         $runner = new CommandRunner($app, 'cake', $factory);
         $result = $runner->run(['cake', 'ex'], $io);
-        $this->assertSame(Command::CODE_SUCCESS, $result);
+        $this->assertSame(CommandInterface::CODE_SUCCESS, $result);
 
         $messages = implode("\n", $output->messages());
         $this->assertStringContainsString('Demo Command!', $messages);
@@ -421,7 +421,7 @@ class CommandRunnerTest extends TestCase
 
         $runner = new CommandRunner($app, 'cake');
         $result = $runner->run(['cake', 'dependency'], $this->getMockIo($output));
-        $this->assertSame(Command::CODE_SUCCESS, $result);
+        $this->assertSame(CommandInterface::CODE_SUCCESS, $result);
 
         $messages = implode("\n", $output->messages());
         $this->assertStringContainsString('Dependency Command', $messages);
@@ -438,7 +438,7 @@ class CommandRunnerTest extends TestCase
 
         $runner = new CommandRunner($app, 'cake');
         $result = $runner->run(['cake', 'ex', '-h'], $this->getMockIo($output));
-        $this->assertSame(Command::CODE_SUCCESS, $result);
+        $this->assertSame(CommandInterface::CODE_SUCCESS, $result);
 
         $messages = implode("\n", $output->messages());
         $this->assertStringContainsString("\ncake ex [-h]", $messages);

+ 4 - 3
tests/TestCase/Console/CommandTest.php

@@ -17,6 +17,7 @@ declare(strict_types=1);
 namespace Cake\Test\TestCase\Console;
 
 use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\Console\ConsoleIo;
 use Cake\Console\ConsoleOptionParser;
 use Cake\Console\Exception\StopException;
@@ -124,7 +125,7 @@ class CommandTest extends TestCase
         $output = new ConsoleOutput();
 
         $this->assertSame(
-            Command::CODE_SUCCESS,
+            CommandInterface::CODE_SUCCESS,
             $command->run(['-h'], $this->getMockIo($output))
         );
         $messages = implode("\n", $output->messages());
@@ -142,7 +143,7 @@ class CommandTest extends TestCase
         $output = new ConsoleOutput();
 
         $this->assertSame(
-            Command::CODE_SUCCESS,
+            CommandInterface::CODE_SUCCESS,
             $command->run(['--help'], $this->getMockIo($output))
         );
         $messages = implode("\n", $output->messages());
@@ -199,7 +200,7 @@ class CommandTest extends TestCase
 
         $output = new ConsoleOutput();
         $result = $command->run([], $this->getMockIo($output));
-        $this->assertSame(Command::CODE_ERROR, $result);
+        $this->assertSame(CommandInterface::CODE_ERROR, $result);
 
         $messages = implode("\n", $output->messages());
         $this->assertStringContainsString(

+ 12 - 12
tests/TestCase/TestSuite/ConsoleIntegrationTestTraitTest.php

@@ -15,7 +15,7 @@ declare(strict_types=1);
  */
 namespace Cake\Test\TestCase\TestSuite;
 
-use Cake\Command\Command;
+use Cake\Console\CommandInterface;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
 use Cake\TestSuite\Stub\MissingConsoleInputException;
 use Cake\TestSuite\TestCase;
@@ -43,7 +43,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
     {
         $this->exec('');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
         $this->assertOutputContains('Current Paths');
         $this->assertExitSuccess();
     }
@@ -56,7 +56,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
         $this->exec('sample');
 
         $this->assertOutputContains('SampleCommand');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
     }
 
     /**
@@ -76,7 +76,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
     {
         $this->exec('format_specifier_command');
         $this->assertOutputContains('format specifier');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
     }
 
     /**
@@ -86,7 +86,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
     {
         $this->exec('routes');
 
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
     }
 
     /**
@@ -99,7 +99,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
         $this->assertErrorEmpty();
         $this->assertOutputContains('arg: arg');
         $this->assertOutputContains('opt: some string');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
     }
 
     /**
@@ -111,7 +111,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
 
         $this->assertErrorEmpty();
         $this->assertOutputContains('arg: {"key":"value"}');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
     }
 
     /**
@@ -123,7 +123,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
 
         $this->assertErrorContains('Missing required argument');
         $this->assertErrorContains('`arg` argument is required');
-        $this->assertExitCode(Command::CODE_ERROR);
+        $this->assertExitCode(CommandInterface::CODE_ERROR);
     }
 
     /**
@@ -134,7 +134,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
         $this->exec('bridge', ['javascript']);
 
         $this->assertErrorContains('No!');
-        $this->assertExitCode(Command::CODE_ERROR);
+        $this->assertExitCode(CommandInterface::CODE_ERROR);
     }
 
     /**
@@ -155,7 +155,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
         $this->exec('bridge', ['cake', 'blue']);
 
         $this->assertOutputContains('You may pass');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
     }
 
     public function testExecWithMockServiceDependencies(): void
@@ -166,7 +166,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
         $this->exec('dependency');
 
         $this->assertOutputContains('constructor inject: {"console-mock":true}');
-        $this->assertExitCode(Command::CODE_SUCCESS);
+        $this->assertExitCode(CommandInterface::CODE_SUCCESS);
     }
 
     /**
@@ -228,7 +228,7 @@ class ConsoleIntegrationTestTraitTest extends TestCase
     public function assertionFailureMessagesProvider(): array
     {
         return [
-            'assertExitCode' => ['assertExitCode', 'Failed asserting that 1 matches exit code 0', 'routes', Command::CODE_ERROR],
+            'assertExitCode' => ['assertExitCode', 'Failed asserting that 1 matches exit code 0', 'routes', CommandInterface::CODE_ERROR],
             'assertOutputEmpty' => ['assertOutputEmpty', 'Failed asserting that output is empty', 'routes'],
             'assertOutputContains' => ['assertOutputContains', 'Failed asserting that \'missing\' is in output', 'routes', 'missing'],
             'assertOutputNotContains' => ['assertOutputNotContains', 'Failed asserting that \'controller\' is not in output', 'routes', 'controller'],