diff --git a/.travis.yml b/.travis.yml index 3dce44e..5b1c333 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: php +sudo: false + php: - 5.4 - 5.5 diff --git a/tests/_helpers/AbstractRequiredTest.php b/tests/_helpers/AbstractRequiredTest.php new file mode 100644 index 0000000..6a0339c --- /dev/null +++ b/tests/_helpers/AbstractRequiredTest.php @@ -0,0 +1,102 @@ +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('admin@test.com', 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)), + ); + } + +} diff --git a/tests/unit/Rule/AbstractRuleTest.php b/tests/_helpers/AbstractRuleTest.php similarity index 100% rename from tests/unit/Rule/AbstractRuleTest.php rename to tests/_helpers/AbstractRuleTest.php diff --git a/tests/_helpers/_generated/CodeGuyActions.php b/tests/_helpers/_generated/CodeGuyActions.php index a7b2974..5a69424 100644 --- a/tests/_helpers/_generated/CodeGuyActions.php +++ b/tests/_helpers/_generated/CodeGuyActions.php @@ -1,4 +1,4 @@ -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('admin@test.com', 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)), - ); - } - } diff --git a/tests/unit/Rule/RequiredWithTest.php b/tests/unit/Rule/RequiredWithTest.php index 8c8bf57..cf4b8ee 100644 --- a/tests/unit/Rule/RequiredWithTest.php +++ b/tests/unit/Rule/RequiredWithTest.php @@ -10,7 +10,7 @@ namespace Fuel\Validation\Rule; -class RequiredWithTest extends RequiredTest +class RequiredWithTest extends AbstractRequiredTest { protected function _before()