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

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

Output a list of possible classnames you might want to generate a test for.
public outputClassChoices ( string $type ) : array
$type string The typename to get classes for.
Результат array
    public function outputClassChoices($type)
    {
        $type = $this->mapType($type);
        $this->out('You must provide a class to bake a test for. Some possible options are:', 2);
        $options = $this->_getClassOptions($type);
        $i = 0;
        foreach ($options as $option) {
            $this->out(++$i . '. ' . $option);
        }
        $this->out('');
        $this->out('Re-run your command as `cake bake ' . $type . ' <classname>`');
        return $options;
    }

Usage Example

Пример #1
0
 /**
  * Test generating class options for table.
  *
  * @return void
  */
 public function testOutputClassOptionsForTablePlugin()
 {
     Plugin::load('BakeTest');
     $this->Task->plugin = 'BakeTest';
     $expected = ['AuthorsTable', 'BakeArticlesTable', 'BakeTestCommentsTable', 'CommentsTable'];
     $choices = $this->Task->outputClassChoices('Table');
     $this->assertSame($expected, $choices);
 }