public function testCanListCategories() { $commandTester = new CommandTester($this->command); $commandTester->execute(array('command' => $this->command->getName(), '-l' => true)); $output = $commandTester->getDisplay(); $this->assertRegExp('/Templating/', $output); $this->assertCount(count(Loader::getCategories($this->configFile)) + 1, explode("\n", $output)); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('list')) { $output->writeln(Loader::getCategories($this->path())); return; } $categories = $input->getArgument('categories'); $number = $input->getOption('number'); $set = Loader::init($number, $categories, $this->path()); if ($set->getQuestions()) { $output->writeln(sprintf('Starting a new set of <info>%s</info> questions (available questions: <info>%s</info>)', count($set->getQuestions()), Loader::count(array(), $this->path()))); $this->askQuestions($set, $input, $output); $this->displayResults($set, $output); } else { $output->writeln('<error>✗</error> No questions can be found.'); } }
public function testCanGetCategoryList() { $this->assertTrue(is_array(Loader::getCategories($this->configFile))); }