Author: Tobias Schlitt
Date: 2006-09-22 22:14:34 +0200 (Fri, 22 Sep 2006)
New Revision: 3544

Log:
- Fixed bug 9046: Last argument not treated invalid option value.

Modified:
   trunk/ConsoleTools/ChangeLog
   trunk/ConsoleTools/src/input.php
   trunk/ConsoleTools/tests/input_test.php

Modified: trunk/ConsoleTools/ChangeLog
===================================================================
--- trunk/ConsoleTools/ChangeLog        2006-09-22 19:35:26 UTC (rev 3543)
+++ trunk/ConsoleTools/ChangeLog        2006-09-22 20:14:34 UTC (rev 3544)
@@ -2,6 +2,7 @@
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 - Added feature to print to a different output target (e.g. stderr).
+- Fixed bug 9046: Last argument not treated invalid option value.
 
 1.1.2 - Monday 28 August 2006
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Modified: trunk/ConsoleTools/src/input.php
===================================================================
--- trunk/ConsoleTools/src/input.php    2006-09-22 19:35:26 UTC (rev 3543)
+++ trunk/ConsoleTools/src/input.php    2006-09-22 20:14:34 UTC (rev 3544)
@@ -833,7 +833,7 @@
         if ( $option->type === ezcConsoleInput::TYPE_NONE )
         {
             // No value expected
-            if ( isset( $args[$i] ) && substr( $args[$i], 0, 1 ) !== '-' )
+            if ( isset( $args[$i] ) && substr( $args[$i], 0, 1 ) !== '-' && 
sizeof( $args ) > ( $i + 1 ) )
             {
                 // But one found
                 throw new ezcConsoleOptionTypeViolationException( $option, 
$args[$i] );

Modified: trunk/ConsoleTools/tests/input_test.php
===================================================================
--- trunk/ConsoleTools/tests/input_test.php     2006-09-22 19:35:26 UTC (rev 
3543)
+++ trunk/ConsoleTools/tests/input_test.php     2006-09-22 20:14:34 UTC (rev 
3544)
@@ -755,7 +755,7 @@
         $this->commonProcessTestFailure( $args, 
'ezcConsoleOptionNotExistsException' );
     }
     
-    public function testProcessFailureType()
+    public function testProcessFailureTypeInt()
     {
         $args = array(
             'foo.php',
@@ -765,6 +765,18 @@
         $this->commonProcessTestFailure( $args, 
'ezcConsoleOptionTypeViolationException' );
     }
     
+    // Bug #9046: New bug: [ConsoleTools] Last argument not treated invalid 
option value
+    public function testProcessNoFailureTypeNone()
+    {
+        $args = array(
+            'foo.php',
+            '-s',
+            'a_parameter'
+        );
+        $res = array( "s" => true );
+        $this->commonProcessTestSuccess( $args, $res );
+    }
+    
     public function testProcessFailureNovalue()
     {
         $args = array(

-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to