Browse Source

Merge pull request #10879 from cakephp/issue-10870

Do not spam users with welcome message in every commands
José Lorenzo Rodríguez 8 years ago
parent
commit
597e12ab4e

+ 0 - 7
src/Console/Shell.php

@@ -284,13 +284,6 @@ class Shell
      */
     protected function _welcome()
     {
-        $this->out();
-        $this->out(sprintf('<info>Welcome to CakePHP %s Console</info>', 'v' . Configure::version()));
-        $this->hr();
-        $this->out(sprintf('App : %s', APP_DIR));
-        $this->out(sprintf('Path: %s', APP));
-        $this->out(sprintf('PHP : %s', phpversion()));
-        $this->hr();
     }
 
     /**

+ 16 - 0
src/Shell/CommandListShell.php

@@ -38,6 +38,22 @@ class CommandListShell extends Shell
     public $tasks = ['Command'];
 
     /**
+     * Displays a header for the shell
+     *
+     * @return void
+     */
+    protected function _welcome()
+    {
+        $this->out();
+        $this->out(sprintf('<info>Welcome to CakePHP %s Console</info>', 'v' . Configure::version()));
+        $this->hr();
+        $this->out(sprintf('App : %s', APP_DIR));
+        $this->out(sprintf('Path: %s', APP));
+        $this->out(sprintf('PHP : %s', phpversion()));
+        $this->hr();
+    }
+
+    /**
      * startup
      *
      * @return void

+ 0 - 1
tests/TestCase/Console/CommandRunnerTest.php

@@ -183,7 +183,6 @@ class CommandRunnerTest extends TestCase
 
         $contents = implode("\n", $output->messages());
         $this->assertContains('URI template', $contents);
-        $this->assertContains('Welcome to CakePHP', $contents);
     }
 
     /**

+ 0 - 5
tests/TestCase/Console/ShellTest.php

@@ -1162,11 +1162,6 @@ TEXT;
         $task->expects($this->never())
             ->method('_welcome');
 
-        // One welcome message output.
-        $io->expects($this->at(2))
-            ->method('out')
-            ->with($this->stringContains('Welcome to CakePHP'));
-
         $shell->Slice = $task;
         $shell->runCommand(['slice', 'one']);
         $this->assertTrue($task->params['requested'], 'Task is requested, no welcome.');

+ 0 - 2
tests/TestCase/TestSuite/ConsoleIntegrationTestCaseTest.php

@@ -43,7 +43,6 @@ class ConsoleIntegrationTestCaseTest extends ConsoleIntegrationTestCase
 
         $this->exec('routes');
 
-        $this->assertOutputContains('Welcome to CakePHP');
         $this->assertExitCode(Shell::CODE_SUCCESS);
     }
 
@@ -69,7 +68,6 @@ class ConsoleIntegrationTestCaseTest extends ConsoleIntegrationTestCase
     {
         $this->exec('routes');
 
-        $this->assertOutputContains('Welcome to CakePHP');
         $this->assertExitCode(Shell::CODE_SUCCESS);
     }