public function testScan()
 {
     $zf2ComponentsListGenerator = new Zf2ComponentsListGenerator();
     $this->assertSame($zf2ComponentsListGenerator->scan(__DIR__ . '/' . self::TEST_PROJECT)->getComponents(), array("zend-authentication" => true, "zend-barcode" => true, "zend-cache" => true, "zend-captcha" => true, "zend-code" => true, "zend-config" => true, "zend-console" => true, "zend-log" => true, "zend-stdlib" => true));
 }
} catch (Zend\Console\Exception\ExceptionInterface $e) {
    file_put_contents('php://stderr', $e->getUsageMessage());
    exit(1);
}
// Print help message if asked or nothing is asked
if (isset($opts->h) || $opts->toArray() == array()) {
    file_put_contents('php://stdout', $opts->getUsageMessage());
    exit(0);
}
// Create options
$options = array();
if (isset($opts->v)) {
    $options['version'] = $opts->v;
}
$zf2ComponentsListGenerator = new Zf2ComponentsListGenerator($options);
$generator = $zf2ComponentsListGenerator->scan($opts->p);
$components = $generator->getComponents();
$console = Console::getInstance();
if (!empty($components)) {
    if (isset($opts->c)) {
        if (!is_file($opts->c)) {
            $console->writeLine($opts->c . ' file does not exist!');
        } else {
            $generator->toFile($opts->c);
            $console->writeLine($opts->c . ' updated', Color::YELLOW);
        }
    } else {
        $generator->toConsole();
    }
} else {
    $console->writeLine('No Zend Framework 2 components found!', Color::GRAY);