From 3eb56bd81d11c5fa0c45e1dd235fe685bd0d8733 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Fri, 21 Jul 2017 09:12:06 +0200 Subject: [PATCH] Core: Fix some issues with version reporting --- src/PHPDraft/In/Tests/ApibFileParserTest.php | 2 +- src/PHPDraft/Out/UI.php | 22 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/PHPDraft/In/Tests/ApibFileParserTest.php b/src/PHPDraft/In/Tests/ApibFileParserTest.php index 7efeacf5..e57fa86b 100644 --- a/src/PHPDraft/In/Tests/ApibFileParserTest.php +++ b/src/PHPDraft/In/Tests/ApibFileParserTest.php @@ -55,7 +55,7 @@ public function testFilenameSetup() * Test if exception when the file doesn't exist * @expectedException \RuntimeException * @expectedExceptionCode 1 - * @expectedExceptionMessageRegExp "API File not found: [a-zA-Z0-9\/]*\/drafter\/non_existing_including_apib" + * @expectedExceptionMessageRegExp "API File not found: [\w\W]*\/drafter\/non_existing_including_apib" * * @return void */ diff --git a/src/PHPDraft/Out/UI.php b/src/PHPDraft/Out/UI.php index 4c72fe2c..f224c3c2 100644 --- a/src/PHPDraft/Out/UI.php +++ b/src/PHPDraft/Out/UI.php @@ -46,7 +46,7 @@ public static function main($argv = []) if (!isset($argv[1])) { file_put_contents('php://stderr', 'Not enough arguments' . PHP_EOL); - self::help(); + (new UI)->help(); throw new \RuntimeException('', 1); } @@ -60,12 +60,12 @@ public static function main($argv = []) if (boolval(preg_match('/^\-/', $argv[1]))) { if (isset($options['h'])) { - self::help(); + (new UI)->help(); throw new \RuntimeException('', 0); } if (isset($options['v'])) { - self::version(); + (new UI)->version(); throw new \RuntimeException('', 0); } @@ -104,14 +104,14 @@ public static function main($argv = []) public function help() { echo 'This is a parser for API Blueprint files in PHP.' . PHP_EOL . PHP_EOL; - echo "The following options can be used:.\n"; - echo "\t-f\tSpecifies the file to parse.\n"; - echo "\t-t\tSpecifies the template to use. (defaults to 'default')\n"; - echo "\t-s\tSort displayed values [All|None|Structures|Webservices] (defaults to the way the objects are in the file)\n"; - echo "\t-i\tSpecifies an image to display in the header.\n"; - echo "\t-c\tSpecifies a CSS file to include (value is put in a link element without checking).\n"; - echo "\t-j\tSpecifies a JS file to include (value is put in a script element without checking).\n"; - echo "\t-h\tDisplays this text.\n"; + echo "The following options can be used:.".PHP_EOL; + echo "\t-f\tSpecifies the file to parse.".PHP_EOL; + echo "\t-t\tSpecifies the template to use. (defaults to 'default')".PHP_EOL; + echo "\t-s\tSort displayed values [All|None|Structures|Webservices] (defaults to the way the objects are in the file)".PHP_EOL; + echo "\t-i\tSpecifies an image to display in the header.".PHP_EOL; + echo "\t-c\tSpecifies a CSS file to include (value is put in a link element without checking).".PHP_EOL; + echo "\t-j\tSpecifies a JS file to include (value is put in a script element without checking).".PHP_EOL; + echo "\t-h\tDisplays this text.".PHP_EOL; } /**