Browse Source

When executing Shell 'main' method the current command name is set to 'main'

Andreas Kristiansen 10 years ago
parent
commit
83c53dd623
2 changed files with 3 additions and 0 deletions
  1. 1 0
      src/Console/Shell.php
  2. 2 0
      tests/TestCase/Console/ShellTest.php

+ 1 - 0
src/Console/Shell.php

@@ -444,6 +444,7 @@ class Shell
 
         if ($this->hasMethod('main')) {
             $this->startup();
+            $this->command = 'main';
             return call_user_func_array([$this, 'main'], $this->args);
         }
 

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

@@ -652,6 +652,7 @@ class ShellTest extends TestCase
             ->will($this->returnValue(true));
         $result = $shell->runCommand(['cakes', '--verbose']);
         $this->assertTrue($result);
+        $this->assertEquals('main', $shell->command);
     }
 
     /**
@@ -670,6 +671,7 @@ class ShellTest extends TestCase
             ->will($this->returnValue(true));
         $result = $shell->runCommand(['hit_me', 'cakes', '--verbose'], true);
         $this->assertTrue($result);
+        $this->assertEquals('hit_me', $shell->command);
     }
 
     /**