Make clear that "Alnum" rule accepts whitespaces

Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
Islam Elshobokshy 2017-12-19 16:20:07 +01:00 committed by Henrique Moody
parent 8fc2484428
commit e70c201691
No known key found for this signature in database
GPG key ID: 221E9281655813A6
2 changed files with 8 additions and 3 deletions

View file

@ -7,12 +7,15 @@ Validates alphanumeric characters from a-Z and 0-9.
```php
v::alnum()->validate('foo 123'); // true
v::alnum()->validate('number 100%'); // false
v::alnum('%')->validate('number 100%'); // true
```
A parameter for extra characters can be used:
Because this rule allows whitespaces by default, you can separate additional
characters with a whitespace:
```php
v::alnum('-')->validate('foo - 123'); // true
v::alnum('- ! :')->validate('foo :- 123 !'); // true
```
This validator allows whitespace, if you want to

View file

@ -77,7 +77,8 @@ class AlnumTest extends \PHPUnit_Framework_TestCase
{
return [
['alganet', ''],
['alganet', 'alganet'],
['foo :- 123 !', '- ! :'],
['number 100%', '%'],
['0alg-anet0', '0-9'],
['1', ''],
["\t", ''],
@ -98,6 +99,7 @@ class AlnumTest extends \PHPUnit_Framework_TestCase
{
return [
['', ''],
['number 100%', ''],
['@#$', ''],
['_', ''],
['dgç', ''],