OSDN Git Service

add test for assoc arg with optional value
authorscribu <mail@scribu.net>
Mon, 19 Aug 2013 22:41:51 +0000 (01:41 +0300)
committerscribu <mail@scribu.net>
Mon, 19 Aug 2013 22:42:05 +0000 (01:42 +0300)
tests/test-arg-validation.php

index f579823..e1c74b8 100644 (file)
@@ -46,5 +46,15 @@ class ArgValidationTests extends PHPUnit_Framework_TestCase {
                $this->assertCount( 1, $errors['fatal'] );
                $this->assertCount( 1, $errors['warning'] );
        }
+
+       function testAssocWithOptionalValue() {
+               $parser = new SynopsisValidator( '[--network[=<id>]]' );
+
+               $assoc_args = array( 'network' => true );
+               $errors = $parser->validate_assoc( $assoc_args );
+
+               $this->assertCount( 0, $errors['fatal'] );
+               $this->assertCount( 0, $errors['warning'] );
+       }
 }