protected function execute(InputInterface $input, OutputInterface $output)
 {
     $expectations = [$input->getArgument('expectation')];
     if ($expectations === [NULL]) {
         $expectations = ExpectationHelper::getAll();
     }
     foreach ($expectations as $expectation) {
         if (!ExpectationHelper::has($expectation)) {
             $output->writeln("<error>Expectation '{$expectation}' not found</error>");
             continue;
         }
         $output->writeln("<info>{$expectation}:</info>");
         $expectation = ExpectationHelper::get($expectation);
         if (method_exists($expectation, "describe")) {
             $output->writeln($expectation::describe());
         }
         $output->writeln("");
     }
 }
Example #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->url = $this->normaliseURL($input->getArgument("url"));
     $this->output = $output;
     $expectations = $input->getOption('expectation');
     if (empty($expectations)) {
         $expectations = ExpectationHelper::getAll();
     }
     $results = ExpectationHelper::initResults();
     $output->writeln(">> Starting tests on " . $this->url);
     foreach ($expectations as $expectation) {
         $result = $this->runExpectation($expectation);
         $results = array_merge_recursive($results, $result);
     }
     $output->writeln(">> Tests complete.");
     $output->writeln(">> <info>" . count($results["PASS"]) . " passes</info>, <comment>" . count($results["WARN"]) . " warnings</comment>, <error>" . count($results["FAIL"]) . " failures</error>");
     $output->writeln(">> Failures represent items that in almost all cases should be fixed.");
     $output->writeln(">> Warnings represent items that in some cases might need to be fixed.");
     $output->writeln(">> Gated sites may produce false postives: Always review these results with a developer.");
     return count($results["FAIL"]);
 }