Rename requireHyphens to requireHyphen for Issn constraint

This commit is contained in:
Antonio J. García Lagar 2013-04-22 20:32:17 +02:00
parent 4e6cc864cf
commit 94173ec58e
3 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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."$/";

View File

@ -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')