merged branch ajgarlag/feature/issn-validator-message-option (PR #7872)
This PR was merged into the master branch. Discussion ---------- [Validator] Rename issn constraint message option. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Rename issn constraint message option to be consistent with all constraints having a single message option as suggested by @stof ata4abfb9550 (L0R23)
Commits -------57c724a
[Validator] Rename issn constraint message option to be consistent with all constraints having a single message option
This commit is contained in:
commit
980b1f0afa
@ -20,7 +20,7 @@ use Symfony\Component\Validator\Constraint;
|
||||
*/
|
||||
class Issn extends Constraint
|
||||
{
|
||||
public $invalidMessage = 'This value is not a valid ISSN.';
|
||||
public $message = 'This value is not a valid ISSN.';
|
||||
public $caseSensitive = false;
|
||||
public $requireHyphen = false;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class IssnValidator extends ConstraintValidator
|
||||
$pattern = "/^".$digitsPattern.$checksumPattern."$/";
|
||||
|
||||
if (!preg_match($pattern, $value)) {
|
||||
$this->context->addViolation($constraint->invalidMessage);
|
||||
$this->context->addViolation($constraint->message);
|
||||
} else {
|
||||
$digits = str_split(strtoupper(str_replace('-', '', $value)));
|
||||
|
||||
@ -55,7 +55,7 @@ class IssnValidator extends ConstraintValidator
|
||||
$checksum = 'X' == reset($digits) ? 10 : (int) reset($digits);
|
||||
|
||||
if (0 != ($sum + $checksum) % 11) {
|
||||
$this->context->addViolation($constraint->invalidMessage);
|
||||
$this->context->addViolation($constraint->message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ class IssnValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context
|
||||
->expects($this->once())
|
||||
->method('addViolation')
|
||||
->with($constraint->invalidMessage);
|
||||
->with($constraint->message);
|
||||
|
||||
$this->validator->validate($issn, $constraint);
|
||||
}
|
||||
@ -159,7 +159,7 @@ class IssnValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context
|
||||
->expects($this->once())
|
||||
->method('addViolation')
|
||||
->with($constraint->invalidMessage);
|
||||
->with($constraint->message);
|
||||
|
||||
$this->validator->validate($issn, $constraint);
|
||||
}
|
||||
@ -186,7 +186,7 @@ class IssnValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context
|
||||
->expects($this->once())
|
||||
->method('addViolation')
|
||||
->with($constraint->invalidMessage);
|
||||
->with($constraint->message);
|
||||
|
||||
$this->validator->validate($issn, $constraint);
|
||||
}
|
||||
@ -200,7 +200,7 @@ class IssnValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->context
|
||||
->expects($this->once())
|
||||
->method('addViolation')
|
||||
->with($constraint->invalidMessage);
|
||||
->with($constraint->message);
|
||||
|
||||
$this->validator->validate($issn, $constraint);
|
||||
}
|
||||
|
Reference in New Issue
Block a user