Rename requireHyphens to requireHyphen for Issn constraint
This commit is contained in:
parent
4e6cc864cf
commit
94173ec58e
@ -22,5 +22,5 @@ class Issn extends Constraint
|
||||
{
|
||||
public $invalidMessage = 'This value is not a valid ISSN.';
|
||||
public $caseSensitive = false;
|
||||
public $requireHyphens = false;
|
||||
public $requireHyphen = false;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class IssnValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Compose regex pattern
|
||||
$digitsPattern = $constraint->requireHyphens ? '\d{4}-\d{3}' : '\d{4}-?\d{3}';
|
||||
$digitsPattern = $constraint->requireHyphen ? '\d{4}-\d{3}' : '\d{4}-?\d{3}';
|
||||
$checksumPattern = $constraint->caseSensitive ? '[\d|X]' : '[\d|X|x]';
|
||||
$pattern = "/^".$digitsPattern.$checksumPattern."$/";
|
||||
|
||||
|
@ -153,9 +153,9 @@ class IssnValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @dataProvider getValidNonHyphenatedIssn
|
||||
*/
|
||||
public function testRequireHyphensIssns($issn)
|
||||
public function testRequireHyphenIssns($issn)
|
||||
{
|
||||
$constraint = new Issn(array('requireHyphens' => true));
|
||||
$constraint = new Issn(array('requireHyphen' => true));
|
||||
$this->context
|
||||
->expects($this->once())
|
||||
->method('addViolation')
|
||||
|
Reference in New Issue
Block a user