Rename rule "True" to "TrueVal"

This commit is contained in:
Henrique Moody 2015-10-07 11:38:24 -03:00
parent fef01d7e09
commit 7f2cdceb31
9 changed files with 33 additions and 33 deletions

View file

@ -33,7 +33,7 @@ All notable changes of the Respect\Validation releases are documented in this fi
- On exceptions, do not display parent message then rule has only one child (#407)
- On exceptions, improve `Object` conversion to string (#399)
- On exceptions, improve conversion of all values by using JSON (#399)
- Use `filter_var()` on "True" and "FalseVal" rules (#409)
- Use `filter_var()` on "TrueVal" and "FalseVal" rules (#409)
### Removed

View file

@ -18,4 +18,4 @@ v::falseVal()->validate('2'); //false
***
See also:
* [True](True.md)
* [TrueVal](TrueVal.md)

View file

@ -1,21 +0,0 @@
# True
- `v::true()`
Validates if a value is considered as `true`.
```php
v::true()->validate(true); //true
v::true()->validate(1); //true
v::true()->validate('1'); //true
v::true()->validate('true'); //true
v::true()->validate('on'); //true
v::true()->validate('yes'); //true
v::true()->validate('0.5'); //false
v::true()->validate('2'); //false
```
***
See also:
* [FalseVal](FalseVal.md)

21
docs/TrueVal.md Normal file
View file

@ -0,0 +1,21 @@
# TrueVal
- `v::trueVal()`
Validates if a value is considered as `true`.
```php
v::trueVal()->validate(true); //true
v::trueVal()->validate(1); //true
v::trueVal()->validate('1'); //true
v::trueVal()->validate('true'); //true
v::trueVal()->validate('on'); //true
v::trueVal()->validate('yes'); //true
v::trueVal()->validate('0.5'); //false
v::trueVal()->validate('2'); //false
```
***
See also:
* [FalseVal](FalseVal.md)

View file

@ -16,7 +16,7 @@
* [Resource](Resource.md)
* [Scalar](Scalar.md)
* [String](String.md)
* [True](True.md)
* [TrueVal](TrueVal.md)
* [Type](Type.md)
* [Xdigit](Xdigit.md)
@ -273,7 +273,7 @@
* [SubdivisionCode](SubdivisionCode.md)
* [SymbolicLink](SymbolicLink.md)
* [Tld](Tld.md)
* [True](True.md)
* [TrueVal](TrueVal.md)
* [Type](Type.md)
* [Uploaded](Uploaded.md)
* [Uppercase](Uppercase.md)

View file

@ -11,7 +11,7 @@
namespace Respect\Validation\Exceptions;
class TrueException extends ValidationException
class TrueValException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(

View file

@ -11,7 +11,7 @@
namespace Respect\Validation\Rules;
class True extends AbstractRule
class TrueVal extends AbstractRule
{
public function validate($input)
{

View file

@ -114,7 +114,7 @@ use Respect\Validation\Rules\Key;
* @method static Validator subdivisionCode(string $countryCode)
* @method static Validator symbolicLink()
* @method static Validator tld()
* @method static Validator true()
* @method static Validator trueVal()
* @method static Validator type(string $type)
* @method static Validator uploaded()
* @method static Validator uppercase()

View file

@ -13,17 +13,17 @@ namespace Respect\Validation\Rules;
/**
* @group rule
* @covers Respect\Validation\Rules\True
* @covers Respect\Validation\Exceptions\TrueException
* @covers Respect\Validation\Rules\TrueVal
* @covers Respect\Validation\Exceptions\TrueValException
*/
class TrueTest extends \PHPUnit_Framework_TestCase
class TrueValTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider validTrueProvider
*/
public function testShouldValidatePatternAccordingToTheDefinedLocale($input)
{
$rule = new True();
$rule = new TrueVal();
$this->assertTrue($rule->validate($input));
}
@ -51,7 +51,7 @@ class TrueTest extends \PHPUnit_Framework_TestCase
*/
public function testShouldNotValidatePatternAccordingToTheDefinedLocale($input)
{
$rule = new True();
$rule = new TrueVal();
$this->assertFalse($rule->validate($input));
}