public function testCanTestForColorSupport()
 {
     // setup the test
     $outputEngine = new NullOutput();
     // perform the test
     $allowColors = $outputEngine->supportsColors();
     // check the results
     $this->assertFalse($allowColors);
 }
Beispiel #2
0
 /**
  * Print the completion message after import is done.
  *
  * @param OutputInterface $output
  * @param stdClass $import
  */
 protected function printExceptions($output, $import)
 {
     /** @var $logger LoggerInterface */
     $logger = $this->getContainer()->get('logger');
     if (null === $output) {
         $output = new NullOutput();
     }
     $output->writeln(['', '', '<info>Import Result</info>', '<info>===============</info>', '<info>' . $import->successes . ' Documents imported.</info>', '<comment>' . count($import->failed) . ' Documents ignored.</comment>']);
     if (!isset($import->exceptionStore['ignore'])) {
         return;
     }
     // If more than 20 exceptions write only into log.
     if (count($import->exceptionStore['ignore']) > 20) {
         foreach ($import->exceptionStore['ignore'] as $msg) {
             $logger->info($msg);
         }
         return;
     }
     foreach ($import->exceptionStore['ignore'] as $msg) {
         $output->writeln('<comment>' . $msg . '</comment>');
         $logger->info($msg);
     }
 }