Skip to content

Commit

Permalink
- Fixed issue #16055: Corrected regression in error message for option
Browse files Browse the repository at this point in the history
  dependencies.
- Fixed error message spelling.


git-svn-id: http://svn.ez.no/svn/ezcomponents/trunk@11350 bc0e7bdc-f0fc-0310-8ff6-f601c06e1256
  • Loading branch information
ts committed Jan 21, 2010
1 parent 47a04da commit f4ecc7f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
7 changes: 7 additions & 0 deletions ConsoleTools/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.6.1 - [RELEASEDATE]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Fixed issue #16055: Corrected regression in error message for option
dependencies.


1.6 - Monday 21 December 2009
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct( ezcConsoleOption $dependingOption, ezcConsoleOption
$message = "The option '{$dependingOption->long}' depends on the option '{$dependantOption->long}' ";
if ( $valueRange !== null )
{
$message .= " to have a value in '{$valueRange}' ";
$message .= "to have a value in '{$valueRange}' ";
}
$message .= "but this one was not submitted.";
parent::__construct( $message );
Expand Down
3 changes: 1 addition & 2 deletions ConsoleTools/src/input/validators/standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ private function validateDependency( ezcConsoleOption $srcOpt, ezcConsoleOptionR
{
throw new ezcConsoleOptionDependencyViolationException(
$srcOpt,
$dep->option,
implode( ', ', $dep->values )
$dep->option
);
}

Expand Down
23 changes: 20 additions & 3 deletions ConsoleTools/tests/input_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,11 @@ public function testProcessFailureDependencies()
'moretext',
'-c' // This one depends on -t, -o, -b and -y
);
$this->commonProcessTestFailure( $args, 'ezcConsoleOptionDependencyViolationException' );
$this->commonProcessTestFailure(
$args,
'ezcConsoleOptionDependencyViolationException',
"The option 'console' depends on the option 'original' but this one was not submitted."
);
}

public function testProcessFailureDependencieValues()
Expand All @@ -1719,7 +1723,11 @@ public function testProcessFailureDependencieValues()
'-x',
);

$this->commonProcessTestFailure( $args, 'ezcConsoleOptionDependencyViolationException' );
$this->commonProcessTestFailure(
$args,
'ezcConsoleOptionDependencyViolationException',
"The option 'execute' depends on the option 'yank' to have a value in 'foo, bar' but this one was not submitted."
);
}

public function testProcessFailureExclusions()
Expand Down Expand Up @@ -2854,7 +2862,7 @@ private function commonProcessTestSuccess( $args, $res )
$this->assertTrue( count( array_diff( $res, $values ) ) == 0, 'Parameters processed incorrectly.' );
}

private function commonProcessTestFailure( $args, $exceptionClass )
private function commonProcessTestFailure( $args, $exceptionClass, $message = null )
{
try
{
Expand All @@ -2867,6 +2875,15 @@ private function commonProcessTestFailure( $args, $exceptionClass )
get_class( $e ),
'Wrong exception thrown for invalid parameter submission. Expected class <'.$exceptionClass.'>, received <'.get_class( $e ).'>'
);

if ( $message !== null )
{
$this->assertEquals(
$message,
$e->getMessage(),
'Exception message incorrect.'
);
}
return;
}
$this->fail( 'Exception not thrown for invalid parameter submition.' );
Expand Down

0 comments on commit f4ecc7f

Please sign in to comment.