forked from fuel/validation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves abstract classes to helper folder for better orgnisation and au…
…toloading. [skip ci]
- Loading branch information
Steve "uru" West
committed
Oct 25, 2015
1 parent
897e5ba
commit 0e4ad25
Showing
7 changed files
with
108 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
language: php | ||
|
||
sudo: false | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
/** | ||
* @package Fuel\Validation | ||
* @version 2.0 | ||
* @author Fuel Development Team | ||
* @license MIT License | ||
* @copyright 2010 - 2013 Fuel Development Team | ||
* @link http://fuelphp.com | ||
*/ | ||
|
||
namespace Fuel\Validation\Rule; | ||
|
||
class AbstractRequiredTest extends AbstractRuleTest | ||
{ | ||
|
||
/** | ||
* {@inheritdocs} | ||
*/ | ||
protected $message = 'The field is required and has not been specified.'; | ||
|
||
protected function _before() | ||
{ | ||
$this->object = new Required; | ||
} | ||
|
||
/** | ||
* @dataProvider validateProvider | ||
*/ | ||
public function testValidate() | ||
{ | ||
list($value, $field, $expected, $data) = func_get_args(); | ||
|
||
$this->assertEquals( | ||
$expected, | ||
$this->object->validate($value, $field, $data) | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdocs} | ||
*/ | ||
public function validateProvider() | ||
{ | ||
return array( | ||
0 => array('[email protected]', null, false, null), | ||
1 => array('', null, false, null), | ||
2 => array(array(), null, false, null), | ||
3 => array(null, null, false, null), | ||
4 => array(false, null, false, null), | ||
|
||
5 => array('test string 5', 'test', false, | ||
array() | ||
), | ||
|
||
6 => array('test string 6', 'test', false, | ||
array( | ||
'foo' => 'bar', | ||
'baz' => 'bat', | ||
) | ||
), | ||
|
||
7 => array('test string 7', 'test', true, | ||
array( | ||
'foo' => 'bar', | ||
'test' => 'value', | ||
'baz' => 'bat', | ||
) | ||
), | ||
|
||
8 => array('bla', 'test', true, null), | ||
9 => array('', 'test', false, null), | ||
10 => array('bla', null, false, array()), | ||
11 => array('', null, false, array()), | ||
|
||
12 => array(false, 'foo', true, | ||
array( | ||
'foo' => false, | ||
) | ||
), | ||
13 => array(true, 'foo', true, | ||
array( | ||
'foo' => true, | ||
) | ||
), | ||
|
||
14 => array(false, 'bar', true, | ||
array( | ||
'bar' => false, | ||
) | ||
), | ||
15 => array(0, 'test', true, | ||
array( | ||
'foo' => 'bar', | ||
'test' => 0, | ||
'baz' => 'bat', | ||
) | ||
), | ||
16 => array(0, 'test', true, array('test' => 0)), | ||
); | ||
} | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,93 +10,7 @@ | |
|
||
namespace Fuel\Validation\Rule; | ||
|
||
class RequiredTest extends AbstractRuleTest | ||
class RequiredTest extends AbstractRequiredTest | ||
{ | ||
|
||
/** | ||
* {@inheritdocs} | ||
*/ | ||
protected $message = 'The field is required and has not been specified.'; | ||
|
||
protected function _before() | ||
{ | ||
$this->object = new Required; | ||
} | ||
|
||
/** | ||
* @dataProvider validateProvider | ||
*/ | ||
public function testValidate() | ||
{ | ||
list($value, $field, $expected, $data) = func_get_args(); | ||
|
||
$this->assertEquals( | ||
$expected, | ||
$this->object->validate($value, $field, $data) | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdocs} | ||
*/ | ||
public function validateProvider() | ||
{ | ||
return array( | ||
0 => array('[email protected]', null, false, null), | ||
1 => array('', null, false, null), | ||
2 => array(array(), null, false, null), | ||
3 => array(null, null, false, null), | ||
4 => array(false, null, false, null), | ||
|
||
5 => array('test string 5', 'test', false, | ||
array() | ||
), | ||
|
||
6 => array('test string 6', 'test', false, | ||
array( | ||
'foo' => 'bar', | ||
'baz' => 'bat', | ||
) | ||
), | ||
|
||
7 => array('test string 7', 'test', true, | ||
array( | ||
'foo' => 'bar', | ||
'test' => 'value', | ||
'baz' => 'bat', | ||
) | ||
), | ||
|
||
8 => array('bla', 'test', true, null), | ||
9 => array('', 'test', false, null), | ||
10 => array('bla', null, false, array()), | ||
11 => array('', null, false, array()), | ||
|
||
12 => array(false, 'foo', true, | ||
array( | ||
'foo' => false, | ||
) | ||
), | ||
13 => array(true, 'foo', true, | ||
array( | ||
'foo' => true, | ||
) | ||
), | ||
|
||
14 => array(false, 'bar', true, | ||
array( | ||
'bar' => false, | ||
) | ||
), | ||
15 => array(0, 'test', true, | ||
array( | ||
'foo' => 'bar', | ||
'test' => 0, | ||
'baz' => 'bat', | ||
) | ||
), | ||
16 => array(0, 'test', true, array('test' => 0)), | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters