From ecd2cc993179436a966029ba210aed11caa08a34 Mon Sep 17 00:00:00 2001 From: Alexandre Gaigalas Date: Wed, 14 Jan 2015 19:23:33 -0200 Subject: [PATCH 1/2] Update PrntTest to use chr() as provider argument On Windows machines, \t produces a pritable character, thus making the tests incompatible between systems. --- tests/library/Respect/Validation/Rules/PrntTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/library/Respect/Validation/Rules/PrntTest.php b/tests/library/Respect/Validation/Rules/PrntTest.php index da90d788e..5226850f8 100644 --- a/tests/library/Respect/Validation/Rules/PrntTest.php +++ b/tests/library/Respect/Validation/Rules/PrntTest.php @@ -76,8 +76,8 @@ public function providerForInvalidPrint() { return array( array(null), - array("foo\nbar"), - array("foo\tbar"), + array("foo" . chr(7) . "bar"), + array("foo" . chr(10) . "bar"), ); } } From a8d1c949624865a1abe61299d788ec0ce021a323 Mon Sep 17 00:00:00 2001 From: Alexandre Gaigalas Date: Wed, 14 Jan 2015 19:27:06 -0200 Subject: [PATCH 2/2] Remove support for undocumented baseXX() shortcut Previously undocumented, this feature is now removed to improve each chain call. --- library/Validator.php | 5 ---- .../Respect/Validation/Rules/BaseTest.php | 30 ------------------- 2 files changed, 35 deletions(-) diff --git a/library/Validator.php b/library/Validator.php index 44eb2e1d2..e57acebee 100644 --- a/library/Validator.php +++ b/library/Validator.php @@ -150,11 +150,6 @@ public function __call($method, $arguments) return $arguments ? static::buildRule($method, $arguments) : new Rules\Not($this); } - if (isset($method{4}) && - substr($method, 0, 4) == 'base' && preg_match('@^base([0-9]{1,2})$@', $method, $match)) { - return $this->addRule(static::buildRule('base', array($match[1]))); - } - return $this->addRule(static::buildRule($method, $arguments)); } diff --git a/tests/library/Respect/Validation/Rules/BaseTest.php b/tests/library/Respect/Validation/Rules/BaseTest.php index eb00a2e23..5e4971911 100644 --- a/tests/library/Respect/Validation/Rules/BaseTest.php +++ b/tests/library/Respect/Validation/Rules/BaseTest.php @@ -7,11 +7,6 @@ class BaseTest extends \PHPUnit_Framework_TestCase { protected $object; - protected function setUp() - { - - } - /** * @dataProvider providerForBase * @@ -24,20 +19,6 @@ public function testBase($base, $input) $this->assertTrue($object->assert($input)); } - /** - * @dataProvider providerForBase - * - */ - public function testBaseShortcut($base, $input) - { - $method = 'base' . $base; - $object = v::$method(); - - $this->assertTrue($object->__invoke($input)); - $this->assertTrue($object->check($input)); - $this->assertTrue($object->assert($input)); - } - /** * @dataProvider providerForInvalidBase * @@ -48,17 +29,6 @@ public function testInvalidBase($base, $input) $this->assertFalse($object->__invoke($input)); } - /** - * @dataProvider providerForInvalidBase - * - */ - public function testInvalidBaseShortcut($base, $input) - { - $method = 'base' . $base; - $object = v::$method(); - $this->assertFalse($object->__invoke($input)); - } - /** * @dataProvider providerForExceptionBase * @expectedException Respect\Validation\Exceptions\BaseException