Bake\Shell\Task\TestTask::main PHP Метод

main() публичный Метод

Execution method always used for tasks
public main ( string | null $type = null, string | null $name = null ) : void | array
$type string | null Class type.
$name string | null Name.
Результат void | array
    public function main($type = null, $name = null)
    {
        parent::main();
        if (empty($type) && empty($name)) {
            return $this->outputTypeChoices();
        }
        if ($this->param('all')) {
            return $this->_bakeAll($type);
        }
        if (empty($name)) {
            return $this->outputClassChoices($type);
        }
        if ($this->bake($type, $name)) {
            $this->out('<success>Done</success>');
        }
    }

Usage Example

Пример #1
0
 /**
  * Test main within a plugin.
  *
  * @return void
  */
 public function testMainPlugin()
 {
     $this->_loadTestPlugin('TestBake');
     $path = Plugin::path('TestBake');
     $this->Task->expects($this->at(0))->method('createFile')->with($this->_normalizePath($path . 'src/Template/Cell/Example/display.ctp'), '');
     $this->Task->expects($this->at(1))->method('createFile')->with($this->_normalizePath($path . 'src/View/Cell/ExampleCell.php'), $this->stringContains('class ExampleCell extends Cell'));
     $this->Task->main('TestBake.Example');
 }
All Usage Examples Of Bake\Shell\Task\TestTask::main