Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into feature/math-biginteger
Browse files Browse the repository at this point in the history
  • Loading branch information
denixport committed Jun 13, 2012
5 parents ecae47b + 0e552a5 + 4f854c2 + 2b17650 + c1c0447 commit 73b1f80
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions test/RegexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,10 @@
*/

namespace ZendTest\Validator;

use Zend\Validator,
ReflectionClass;

/**
* Test helper
*/

/**
* @see Zend_Validator_Regex
*/


/**
* @category Zend
* @package Zend_Validator
Expand Down Expand Up @@ -111,25 +103,33 @@ public function testNonStringValidation()

/**
* @ZF-11863
* @dataProvider specialCharValidationProvider
*/
public function testSpecialCharValidation()
public function testSpecialCharValidation($expected, $input)
{
/**
* The elements of each array are, in order:
* - pattern
* - expected validation result
* - array of test input values
*/
$valuesExpected = array(
array('/^[[:alpha:]\']+$/iu', true, array('test', 'òèùtestòò', 'testà', 'teààst', 'ààòòìùéé', 'èùòìiieeà')),
array('/^[[:alpha:]\']+$/iu', false, array('test99'))
);
foreach ($valuesExpected as $element) {
$validator = new Validator\Regex($element[0]);
foreach ($element[2] as $input) {
$this->assertEquals($element[1], $validator->isValid($input));
}
}
// Locale changed due a bug with PHP versions lower than 5.3.4 (https://bugs.php.net/bug.php?id=52971)
setlocale(LC_ALL, 'es_ES');
$validator = new Validator\Regex('/^[[:alpha:]\']+$/iu');
$this->assertEquals($expected, $validator->isValid($input),
'Reason: ' . implode('', $validator->getMessages()));
}

/**
* The elements of each array are, in order:
* - expected validation result
* - test input value
*/
public function specialCharValidationProvider()
{
return array(
array(true, 'test'),
array(true, 'òèùtestòò'),
array(true, 'testà'),
array(true, 'teààst'),
array(true, 'ààòòìùéé'),
array(true, 'èùòìiieeà'),
array(false, 'test99'),
);
}

public function testEqualsMessageTemplates()
Expand Down

0 comments on commit 73b1f80

Please sign in to comment.