X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fsrc%2Fpharext%2FCliArgsTest.php;h=887ce86f381a0f2c6b3ad5616ac1b91f18d6f45c;hb=4b95e2c390f07d2eb22d099c33b68c7f9ff97777;hp=bdfdb1563de87de4ae3b850f6f0bd3e06ac5295d;hpb=cbb9788d2983cf6c6a03a7e9b94a427589b7bffc;p=pharext%2Fpharext diff --git a/tests/src/pharext/CliArgsTest.php b/tests/src/pharext/CliArgsTest.php index bdfdb15..887ce86 100644 --- a/tests/src/pharext/CliArgsTest.php +++ b/tests/src/pharext/CliArgsTest.php @@ -4,6 +4,8 @@ namespace pharext; require __DIR__."/../../autoload.php"; +use pharext\Cli\Args as CliArgs; + class CliArgsTest extends \PHPUnit_Framework_TestCase { /** @@ -45,7 +47,7 @@ class CliArgsTest extends \PHPUnit_Framework_TestCase $spec["-".$arg[0]] = $arg; $spec["--".$arg[1]] = $arg; } - $this->assertSame($args->getSpec(), $spec); + $this->assertSame($args->getCompiledSpec(), $spec); } public function testParseNothing() { @@ -112,6 +114,14 @@ class CliArgsTest extends \PHPUnit_Framework_TestCase } $this->assertTrue(isset($error)); } + + public function testLongEquals() { + $this->assertNull($this->args->configure); + foreach ($this->args->parse(1, ["--configure=--with-lib=/opt/lib"]) as $error) { + throw new \Exception("Unexpected parse error: $error"); + } + $this->assertSame(["--with-lib=/opt/lib"], $this->args->configure); + } public function testValidate() { $this->args->compile([ @@ -127,25 +137,4 @@ class CliArgsTest extends \PHPUnit_Framework_TestCase $this->assertTrue(isset($error)); } - public function testHelp() { - $this->expectOutputString(<<] - - -h|--help Display help - -v|--verbose More output - -q|--quiet Less output - -p|--prefix PHP installation prefix if phpize is not in \$PATH, e.g. /opt/php7 - -n|--common-name PHP common program name, e.g. php5 or zts-php [php] - -c|--configure Additional extension configure flags, e.g. -c --with-flag - -s|--sudo [] Installation might need increased privileges [sudo -S %s] - - -EOF - ); - $this->args->help("testprog"); - } - }