public function testScan_ParseError() { $file = new \r8\FileSys\File(__FILE__); $parser = $this->getMock('\\vc\\iface\\Parser'); $parser->expects($this->once())->method("parse")->with($this->equalTo($file))->will($this->throwException($this->getMock('\\vc\\Tokens\\Exception'))); $storage = $this->getMock('\\vc\\iface\\Storage'); $storage->expects($this->never())->method("store"); $scanner = new \vc\App\Scanner($this->getParseLogger(), $parser, $storage); $scanner->scan(\r8(new \vc\App\Paths())->addInput($file)); }
* @author James Frasca <*****@*****.**> * @copyright Copyright 2009, James Frasca, All Rights Reserved */ // Set up the environment require_once __DIR__ . '/include.php'; // Get the command line argument parser $cliParser = \vc\Provider\CLI::getArgParser(); // Attempt to parse the input arguments try { $result = $cliParser->process(); } catch (\r8\Exception\Data $err) { echo "Error!\n" . $err->getMessage() . "\n" . "For details about using this command, use the '--help' option\n\n"; exit; } // If they requested version... if ($result->flagExists('v')) { echo "PHP Vocab, version " . VOCAB_VERSION . " - http://vocab.roundeights.com\n" . "Round Eights, version " . r8_VERSION . " - http://www.roundeights.com\n\n"; exit; } else { if ($result->flagExists('h') || $result->countArgs() == 0) { echo $cliParser->getHelp(); exit; } } $config = \r8(new \vc\App\Builder())->build($result); $parser = \vc\Provider\Parser::getFileParser(); $logger = \vc\Provider\Log::getParseLogger(); $storage = new \vc\Storage\Memory(); $scanner = new \vc\App\Scanner($logger, $parser, $storage); $scanner->scan($config->getInputPaths());