Skip to content

Commit

Permalink
Merge "Use ConstraintParameterException::getViolationMessage()"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Feb 19, 2018
2 parents 88ea541 + 3e5a320 commit 257ff8b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/ConstraintCheck/DelegatingConstraintChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ private function checkConstraintsForMainSnak(
try {
$exceptions = $this->constraintParameterParser->parseExceptionParameter( $parameters );
} catch ( ConstraintParameterException $e ) {
$result[] = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage() );
$result[] = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
continue;
}

Expand Down Expand Up @@ -542,7 +542,7 @@ private function getCheckResultFor( Context $context, Constraint $constraint ) {
try {
$result = $checker->checkConstraint( $context, $constraint );
} catch ( ConstraintParameterException $e ) {
$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage() );
$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
} catch ( SparqlHelperException $e ) {
$message = new ViolationMessage( 'wbqc-violation-message-sparql-error' );
$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
Expand All @@ -555,7 +555,7 @@ private function getCheckResultFor( Context $context, Constraint $constraint ) {
$constraintStatus = $this->constraintParameterParser
->parseConstraintStatusParameter( $constraint->getConstraintParameters() );
} catch ( ConstraintParameterException $e ) {
$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage() );
$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
$constraintStatus = null;
}
if ( $constraintStatus === null ) {
Expand Down Expand Up @@ -601,7 +601,7 @@ private function handleScope(
$constraint->getConstraintTypeItemId()
);
} catch ( ConstraintParameterException $e ) {
return new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage() );
return new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
}
if ( $checkedContextTypes === null ) {
$checkedContextTypes = $checker->getDefaultContextTypes();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/Helper/ConstraintParameterParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private function assertThrowsConstraintParameterException( $method, array $argum
$this->constraint,
[],
CheckResult::STATUS_VIOLATION,
$exception->getMessage()
$exception->getViolationMessage()
);
$this->assertViolation( $checkResult, $messageKey );
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/Helper/SparqlHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public function testMatchesRegularExpressionWithSparqlBadRegex() {
$this->getMockBuilder( Constraint::class )->disableOriginalConstructor()->getMock(),
[],
CheckResult::STATUS_VIOLATION,
$exception->getMessage()
$exception->getViolationMessage()
);
$this->assertViolation( $checkResult, $messageKey );
}
Expand Down

0 comments on commit 257ff8b

Please sign in to comment.