Permalink
Browse files

Merge pull request #120 from pborreli/typos

Fixed typos
  • Loading branch information...
alganet committed Feb 26, 2013
2 parents 9be0ee8 + 2776a40 commit 06224c04369eec63777da2ce9acf4afee6b92a5d
View
@@ -33,7 +33,7 @@ The Hello World validator is something like this:
### Chained Validation ### Chained Validation
It is possible to use validators in a chain. Sample below validates a string It is possible to use validators in a chain. Sample below validates a string
containing numbers and letters, no whitspace and length between 1 and 15. containing numbers and letters, no whitespace and length between 1 and 15.
$usernameValidator = v::alnum()->noWhitespace()->length(1,15); $usernameValidator = v::alnum()->noWhitespace()->length(1,15);
$usernameValidator->validate('alganet'); //true $usernameValidator->validate('alganet'); //true
@@ -62,7 +62,7 @@ validated object as the first node in the chain.
### Input optional ### Input optional
All validators treat input as optional and will accept empty string input as valid, All validators treat input as optional and will accept empty string input as valid,
unless otherwies stated in the documentation. unless otherwise stated in the documentation.
We us the `v:notEmpty()` validator prefixed to disallow empty input and effectively We us the `v:notEmpty()` validator prefixed to disallow empty input and effectively
define the field as mandatory as input will be required or validation will fail. define the field as mandatory as input will be required or validation will fail.
@@ -85,7 +85,7 @@ Once created, you can reuse your validator anywhere. Remember $usernameValidator
### Informative Exceptions ### Informative Exceptions
When something goes wrong, Validation can tell you exacty what's going on. For this, When something goes wrong, Validation can tell you exactly what's going on. For this,
we use the `assert()` method instead of `validate()`: we use the `assert()` method instead of `validate()`:
try { try {
@@ -277,7 +277,7 @@ Reference
### Regional ### Regional
* v::tld() * v::tld()
* v::coutryCode() * v::countryCode()
### Files ### Files
@@ -913,7 +913,7 @@ See also:
Validates if the input is an instance of the given class or interface. Validates if the input is an instance of the given class or interface.
v::instance('DateTime')->validate(new DateTime); //true v::instance('DateTime')->validate(new DateTime); //true
v::instance('Traversable')->validate(new ArrayObjet); //true v::instance('Traversable')->validate(new ArrayObject); //true
Message template for this validator includes `{{instanceName}}`. Message template for this validator includes `{{instanceName}}`.
@@ -1165,7 +1165,7 @@ Negates any rule.
v::not(v::ip())->validate('foo'); //true v::not(v::ip())->validate('foo'); //true
using a shorcut using a shortcut
v::ip()->not()->validate('foo'); //true v::ip()->not()->validate('foo'); //true
@@ -1175,7 +1175,7 @@ You can negate complex, grouped or chained validators as well:
v::not(v::int()->positive())->validate(-1.5); //true v::not(v::int()->positive())->validate(-1.5); //true
using a shorcut using a shortcut
v::int()->positive()->not()->validate(-1.5); //true v::int()->positive()->not()->validate(-1.5); //true
@@ -1188,7 +1188,7 @@ See also:
#### v::notEmpty() #### v::notEmpty()
Validates if the given input is not empty or in other words is input mandatory and Validates if the given input is not empty or in other words is input mandatory and
roequired. This function also takes whitespace into account, use `noWhitespace()` required. This function also takes whitespace into account, use `noWhitespace()`
if no spaces or linebreaks and other whitespace anywhere in the input is desired. if no spaces or linebreaks and other whitespace anywhere in the input is desired.
v::string()->notEmpty()->validate(''); //false v::string()->notEmpty()->validate(''); //false
@@ -1402,7 +1402,7 @@ For arrays:
v::startsWith('lorem')->validate(array('lorem', 'ipsum')); //true v::startsWith('lorem')->validate(array('lorem', 'ipsum')); //true
`true` may be passed as a parameter to indicate idetical comparison `true` may be passed as a parameter to indicate identical comparison
instead of equal. instead of equal.
Message template for this validator includes `{{startValue}}`. Message template for this validator includes `{{startValue}}`.
@@ -1492,7 +1492,7 @@ See also:
A ternary validator that accepts three parameters. A ternary validator that accepts three parameters.
When the $if validates, returns validation for $then. When the $if validates, returns validation for $then.
When the $if doesnt' validate, returns validation for $else. When the $if doesn't validate, returns validation for $else.
v::when(v::int(), v::positive(), v::notEmpty())->validate($input); v::when(v::int(), v::positive(), v::notEmpty())->validate($input);
@@ -6,9 +6,9 @@ class AlnumTest extends \PHPUnit_Framework_TestCase
/** /**
* @dataProvider providerForValidAlnum * @dataProvider providerForValidAlnum
*/ */
public function testValidAlnumCharsShouldReturnTrue($validAlnum, $aditional) public function testValidAlnumCharsShouldReturnTrue($validAlnum, $additional)
{ {
$validator = new Alnum($aditional); $validator = new Alnum($additional);
$this->assertTrue($validator->validate($validAlnum)); $this->assertTrue($validator->validate($validAlnum));
$this->assertTrue($validator->check($validAlnum)); $this->assertTrue($validator->check($validAlnum));
$this->assertTrue($validator->assert($validAlnum)); $this->assertTrue($validator->assert($validAlnum));
@@ -18,9 +18,9 @@ public function testValidAlnumCharsShouldReturnTrue($validAlnum, $aditional)
* @dataProvider providerForInvalidAlnum * @dataProvider providerForInvalidAlnum
* @expectedException Respect\Validation\Exceptions\AlnumException * @expectedException Respect\Validation\Exceptions\AlnumException
*/ */
public function testInvalidAlnumCharsShouldThrowAlnumExceptionAndReturnFalse($invalidAlnum, $aditional) public function testInvalidAlnumCharsShouldThrowAlnumExceptionAndReturnFalse($invalidAlnum, $additional)
{ {
$validator = new Alnum($aditional); $validator = new Alnum($additional);
$this->assertFalse($validator->validate($invalidAlnum)); $this->assertFalse($validator->validate($invalidAlnum));
$this->assertFalse($validator->assert($invalidAlnum)); $this->assertFalse($validator->assert($invalidAlnum));
} }
@@ -29,17 +29,17 @@ public function testInvalidAlnumCharsShouldThrowAlnumExceptionAndReturnFalse($in
* @dataProvider providerForInvalidParams * @dataProvider providerForInvalidParams
* @expectedException Respect\Validation\Exceptions\ComponentException * @expectedException Respect\Validation\Exceptions\ComponentException
*/ */
public function testInvalidConstructorParamsShouldThrowComponentExceptionUponInstantiation($aditional) public function testInvalidConstructorParamsShouldThrowComponentExceptionUponInstantiation($additional)
{ {
$validator = new Alnum($aditional); $validator = new Alnum($additional);
} }
/** /**
* @dataProvider providerAdditionalChars * @dataProvider providerAdditionalChars
*/ */
public function testAdditionalCharsShouldBeRespected($aditional, $query) public function testAdditionalCharsShouldBeRespected($additional, $query)
{ {
$validator = new Alnum($aditional); $validator = new Alnum($additional);
$this->assertTrue($validator->validate($query)); $this->assertTrue($validator->validate($query));
} }
@@ -6,9 +6,9 @@ class AlphaTest extends \PHPUnit_Framework_TestCase
/** /**
* @dataProvider providerForValidAlpha * @dataProvider providerForValidAlpha
*/ */
public function testValidAlphanumericCharsShouldReturnTrue($validAlpha, $aditional) public function testValidAlphanumericCharsShouldReturnTrue($validAlpha, $additional)
{ {
$validator = new Alpha($aditional); $validator = new Alpha($additional);
$this->assertTrue($validator->validate($validAlpha)); $this->assertTrue($validator->validate($validAlpha));
$this->assertTrue($validator->check($validAlpha)); $this->assertTrue($validator->check($validAlpha));
$this->assertTrue($validator->assert($validAlpha)); $this->assertTrue($validator->assert($validAlpha));
@@ -18,9 +18,9 @@ public function testValidAlphanumericCharsShouldReturnTrue($validAlpha, $adition
* @dataProvider providerForInvalidAlpha * @dataProvider providerForInvalidAlpha
* @expectedException Respect\Validation\Exceptions\AlphaException * @expectedException Respect\Validation\Exceptions\AlphaException
*/ */
public function testInvalidAlphanumericCharsShouldThrowAlphaException($invalidAlpha, $aditional) public function testInvalidAlphanumericCharsShouldThrowAlphaException($invalidAlpha, $additional)
{ {
$validator = new Alpha($aditional); $validator = new Alpha($additional);
$this->assertFalse($validator->validate($invalidAlpha)); $this->assertFalse($validator->validate($invalidAlpha));
$this->assertFalse($validator->assert($invalidAlpha)); $this->assertFalse($validator->assert($invalidAlpha));
} }
@@ -29,17 +29,17 @@ public function testInvalidAlphanumericCharsShouldThrowAlphaException($invalidAl
* @dataProvider providerForInvalidParams * @dataProvider providerForInvalidParams
* @expectedException Respect\Validation\Exceptions\ComponentException * @expectedException Respect\Validation\Exceptions\ComponentException
*/ */
public function testInvalidConstructorParamsShouldThrowComponentExeption($aditional) public function testInvalidConstructorParamsShouldThrowComponentException($additional)
{ {
$validator = new Alpha($aditional); $validator = new Alpha($additional);
} }
/** /**
* @dataProvider providerAdditionalChars * @dataProvider providerAdditionalChars
*/ */
public function testAdditionalCharsShouldBeRespected($aditional, $query) public function testAdditionalCharsShouldBeRespected($additional, $query)
{ {
$validator = new Alpha($aditional); $validator = new Alpha($additional);
$this->assertTrue($validator->validate($query)); $this->assertTrue($validator->validate($query));
} }
@@ -42,15 +42,15 @@ public function testAbsentAttributeShouldRaiseAttributeException_on_check()
} }
/** /**
* @dataProvider providerForInvalidAtrributeNames * @dataProvider providerForInvalidAttributeNames
* @expectedException Respect\Validation\Exceptions\ComponentException * @expectedException Respect\Validation\Exceptions\ComponentException
*/ */
public function testInvalidConstructorArgumentsShouldThrowComponentException($attributeName) public function testInvalidConstructorArgumentsShouldThrowComponentException($attributeName)
{ {
$validator = new Attribute($attributeName); $validator = new Attribute($attributeName);
} }
public function providerForInvalidAtrributeNames() public function providerForInvalidAttributeNames()
{ {
return array( return array(
array(new \stdClass), array(new \stdClass),
@@ -41,7 +41,7 @@ public function testNotIntegerCnh($cnh)
} }
/** /**
* @dataProvider invalidCnhLenghtProvider * @dataProvider invalidCnhLengthProvider
* @expectedException Respect\Validation\Exceptions\CnhException * @expectedException Respect\Validation\Exceptions\CnhException
*/ */
public function testInvalidLengthCnh($cnh) public function testInvalidLengthCnh($cnh)
@@ -141,7 +141,7 @@ public function notIntegerCnhProvider()
); );
} }
public function invalidCnhLenghtProvider() public function invalidCnhLengthProvider()
{ {
return array( return array(
array('00265003006461'), array('00265003006461'),
@@ -6,19 +6,19 @@ class CntrlTest extends \PHPUnit_Framework_TestCase
/** /**
* @dataProvider providerForValidCntrl * @dataProvider providerForValidCntrl
*/ */
public function testValidDataWithCntrlShouldReturnTrue($validCntrl, $aditional='') public function testValidDataWithCntrlShouldReturnTrue($validCntrl, $additional='')
{ {
$validator = new Cntrl($aditional); $validator = new Cntrl($additional);
$this->assertTrue($validator->validate($validCntrl)); $this->assertTrue($validator->validate($validCntrl));
} }
/** /**
* @dataProvider providerForInvalidCntrl * @dataProvider providerForInvalidCntrl
* @expectedException Respect\Validation\Exceptions\CntrlException * @expectedException Respect\Validation\Exceptions\CntrlException
*/ */
public function testInvalidCntrlShouldFailAndThrowCntrlException($invalidCntrl, $aditional='') public function testInvalidCntrlShouldFailAndThrowCntrlException($invalidCntrl, $additional='')
{ {
$validator = new Cntrl($aditional); $validator = new Cntrl($additional);
$this->assertFalse($validator->validate($invalidCntrl)); $this->assertFalse($validator->validate($invalidCntrl));
$this->assertFalse($validator->assert($invalidCntrl)); $this->assertFalse($validator->assert($invalidCntrl));
} }
@@ -27,17 +27,17 @@ public function testInvalidCntrlShouldFailAndThrowCntrlException($invalidCntrl,
* @dataProvider providerForInvalidParams * @dataProvider providerForInvalidParams
* @expectedException Respect\Validation\Exceptions\ComponentException * @expectedException Respect\Validation\Exceptions\ComponentException
*/ */
public function testInvalidConstructorParamsShouldThrowComponentExceptionUponInstantiation($aditional) public function testInvalidConstructorParamsShouldThrowComponentExceptionUponInstantiation($additional)
{ {
$validator = new Cntrl($aditional); $validator = new Cntrl($additional);
} }
/** /**
* @dataProvider providerAdditionalChars * @dataProvider providerAdditionalChars
*/ */
public function testAdditionalCharsShouldBeRespected($aditional, $query) public function testAdditionalCharsShouldBeRespected($additional, $query)
{ {
$validator = new Cntrl($aditional); $validator = new Cntrl($additional);
$this->assertTrue($validator->validate($query)); $this->assertTrue($validator->validate($query));
} }
@@ -6,19 +6,19 @@ class ConsonantTest extends \PHPUnit_Framework_TestCase
/** /**
* @dataProvider providerForValidConsonants * @dataProvider providerForValidConsonants
*/ */
public function testValidDataWithConsonantsShouldReturnTrue($validConsonants, $aditional='') public function testValidDataWithConsonantsShouldReturnTrue($validConsonants, $additional='')
{ {
$validator = new Consonant($aditional); $validator = new Consonant($additional);
$this->assertTrue($validator->validate($validConsonants)); $this->assertTrue($validator->validate($validConsonants));
} }
/** /**
* @dataProvider providerForInvalidConsonants * @dataProvider providerForInvalidConsonants
* @expectedException Respect\Validation\Exceptions\ConsonantException * @expectedException Respect\Validation\Exceptions\ConsonantException
*/ */
public function testInvalidConsonantsShouldFailAndThrowConsonantException($invalidConsonants, $aditional='') public function testInvalidConsonantsShouldFailAndThrowConsonantException($invalidConsonants, $additional='')
{ {
$validator = new Consonant($aditional); $validator = new Consonant($additional);
$this->assertFalse($validator->validate($invalidConsonants)); $this->assertFalse($validator->validate($invalidConsonants));
$this->assertFalse($validator->assert($invalidConsonants)); $this->assertFalse($validator->assert($invalidConsonants));
} }
@@ -27,17 +27,17 @@ public function testInvalidConsonantsShouldFailAndThrowConsonantException($inval
* @dataProvider providerForInvalidParams * @dataProvider providerForInvalidParams
* @expectedException Respect\Validation\Exceptions\ComponentException * @expectedException Respect\Validation\Exceptions\ComponentException
*/ */
public function testInvalidConstructorParamsShouldThrowComponentExceptionUponInstantiation($aditional) public function testInvalidConstructorParamsShouldThrowComponentExceptionUponInstantiation($additional)
{ {
$validator = new Consonant($aditional); $validator = new Consonant($additional);
} }
/** /**
* @dataProvider providerAdditionalChars * @dataProvider providerAdditionalChars
*/ */
public function testAdditionalCharsShouldBeRespected($aditional, $query) public function testAdditionalCharsShouldBeRespected($additional, $query)
{ {
$validator = new Consonant($aditional); $validator = new Consonant($additional);
$this->assertTrue($validator->validate($query)); $this->assertTrue($validator->validate($query));
} }
@@ -18,7 +18,7 @@ public function testStringsContainingExpectedValueShouldPass($start, $input)
* @dataProvider providerForNotContains * @dataProvider providerForNotContains
* @expectedException Respect\Validation\Exceptions\ContainsException * @expectedException Respect\Validation\Exceptions\ContainsException
*/ */
public function testStringsNotContainsExpectedValueShoudNotPass($start, $input, $identical=false) public function testStringsNotContainsExpectedValueShouldNotPass($start, $input, $identical=false)
{ {
$v = new Contains($start, $identical); $v = new Contains($start, $identical);
$this->assertFalse($v->__invoke($input)); $this->assertFalse($v->__invoke($input));
@@ -33,7 +33,7 @@ public function testInvalidDateShouldFail()
{ {
$this->assertFalse($this->dateValidator->__invoke('aids')); $this->assertFalse($this->dateValidator->__invoke('aids'));
} }
public function testInvalidDateShouldFail_on_invalid_convertions() public function testInvalidDateShouldFail_on_invalid_conversions()
{ {
$this->dateValidator->format = 'Y-m-d'; $this->dateValidator->format = 'Y-m-d';
$this->assertFalse($this->dateValidator->__invoke('2009-12-00')); $this->assertFalse($this->dateValidator->__invoke('2009-12-00'));
@@ -6,19 +6,19 @@ class DigitTest extends \PHPUnit_Framework_TestCase
/** /**
* @dataProvider providerForValidDigits * @dataProvider providerForValidDigits
*/ */
public function testValidDataWithDigitsShouldReturnTrue($validDigits, $aditional='') public function testValidDataWithDigitsShouldReturnTrue($validDigits, $additional='')
{ {
$validator = new Digit($aditional); $validator = new Digit($additional);
$this->assertTrue($validator->validate($validDigits)); $this->assertTrue($validator->validate($validDigits));
} }
/** /**
* @dataProvider providerForInvalidDigits * @dataProvider providerForInvalidDigits
* @expectedException Respect\Validation\Exceptions\DigitException * @expectedException Respect\Validation\Exceptions\DigitException
*/ */
public function testInvalidDigitsShouldFailAndThrowDigitException($invalidDigits, $aditional='') public function testInvalidDigitsShouldFailAndThrowDigitException($invalidDigits, $additional='')
{ {
$validator = new Digit($aditional); $validator = new Digit($additional);
$this->assertFalse($validator->validate($invalidDigits)); $this->assertFalse($validator->validate($invalidDigits));
$this->assertFalse($validator->assert($invalidDigits)); $this->assertFalse($validator->assert($invalidDigits));
} }
@@ -27,17 +27,17 @@ public function testInvalidDigitsShouldFailAndThrowDigitException($invalidDigits
* @dataProvider providerForInvalidParams * @dataProvider providerForInvalidParams
* @expectedException Respect\Validation\Exceptions\ComponentException * @expectedException Respect\Validation\Exceptions\ComponentException
*/ */
public function testInvalidConstructorParamsShouldThrowComponentExceptionUponInstantiation($aditional) public function testInvalidConstructorParamsShouldThrowComponentExceptionUponInstantiation($additional)
{ {
$validator = new Digit($aditional); $validator = new Digit($additional);
} }
/** /**
* @dataProvider providerAdditionalChars * @dataProvider providerAdditionalChars
*/ */
public function testAdditionalCharsShouldBeRespected($aditional, $query) public function testAdditionalCharsShouldBeRespected($additional, $query)
{ {
$validator = new Digit($aditional); $validator = new Digit($additional);
$this->assertTrue($validator->validate($query)); $this->assertTrue($validator->validate($query));
} }
@@ -18,7 +18,7 @@ public function testStringsEndingWithExpectedValueShouldPass($start, $input)
* @dataProvider providerForNotEndsWith * @dataProvider providerForNotEndsWith
* @expectedException Respect\Validation\Exceptions\EndsWithException * @expectedException Respect\Validation\Exceptions\EndsWithException
*/ */
public function testStringsNotEndingWithExpectedValueShoudNotPass($start, $input, $caseSensitive=false) public function testStringsNotEndingWithExpectedValueShouldNotPass($start, $input, $caseSensitive=false)
{ {
$v = new EndsWith($start, $caseSensitive); $v = new EndsWith($start, $caseSensitive);
$this->assertFalse($v->__invoke($input)); $this->assertFalse($v->__invoke($input));
@@ -18,7 +18,7 @@ public function testStringsContainingExpectedValueShouldPass($start, $input)
* @dataProvider providerForNotEquals * @dataProvider providerForNotEquals
* @expectedException Respect\Validation\Exceptions\EqualsException * @expectedException Respect\Validation\Exceptions\EqualsException
*/ */
public function testStringsNotEqualsExpectedValueShoudNotPass($start, $input, $identical=false) public function testStringsNotEqualsExpectedValueShouldNotPass($start, $input, $identical=false)
{ {
$v = new Equals($start, $identical); $v = new Equals($start, $identical);
$this->assertFalse($v->__invoke($input)); $this->assertFalse($v->__invoke($input));
Oops, something went wrong.

0 comments on commit 06224c0

Please sign in to comment.