Skip to content

Commit 54c61f0

Browse files
committed
Merge pull request #243 from alganet/0.7
Removing undocumented 'base' shortcut, fixing PrntTest
2 parents 0b3012b + a8d1c94 commit 54c61f0

File tree

3 files changed

+2
-37
lines changed

3 files changed

+2
-37
lines changed

library/Validator.php

-5
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,6 @@ public function __call($method, $arguments)
150150
return $arguments ? static::buildRule($method, $arguments) : new Rules\Not($this);
151151
}
152152

153-
if (isset($method{4}) &&
154-
substr($method, 0, 4) == 'base' && preg_match('@^base([0-9]{1,2})$@', $method, $match)) {
155-
return $this->addRule(static::buildRule('base', array($match[1])));
156-
}
157-
158153
return $this->addRule(static::buildRule($method, $arguments));
159154
}
160155

tests/library/Respect/Validation/Rules/BaseTest.php

-30
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ class BaseTest extends \PHPUnit_Framework_TestCase
77
{
88
protected $object;
99

10-
protected function setUp()
11-
{
12-
13-
}
14-
1510
/**
1611
* @dataProvider providerForBase
1712
*
@@ -24,20 +19,6 @@ public function testBase($base, $input)
2419
$this->assertTrue($object->assert($input));
2520
}
2621

27-
/**
28-
* @dataProvider providerForBase
29-
*
30-
*/
31-
public function testBaseShortcut($base, $input)
32-
{
33-
$method = 'base' . $base;
34-
$object = v::$method();
35-
36-
$this->assertTrue($object->__invoke($input));
37-
$this->assertTrue($object->check($input));
38-
$this->assertTrue($object->assert($input));
39-
}
40-
4122
/**
4223
* @dataProvider providerForInvalidBase
4324
*
@@ -48,17 +29,6 @@ public function testInvalidBase($base, $input)
4829
$this->assertFalse($object->__invoke($input));
4930
}
5031

51-
/**
52-
* @dataProvider providerForInvalidBase
53-
*
54-
*/
55-
public function testInvalidBaseShortcut($base, $input)
56-
{
57-
$method = 'base' . $base;
58-
$object = v::$method();
59-
$this->assertFalse($object->__invoke($input));
60-
}
61-
6232
/**
6333
* @dataProvider providerForExceptionBase
6434
* @expectedException Respect\Validation\Exceptions\BaseException

tests/library/Respect/Validation/Rules/PrntTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public function providerForInvalidPrint()
7676
{
7777
return array(
7878
array(null),
79-
array("foo\nbar"),
80-
array("foo\tbar"),
79+
array("foo" . chr(7) . "bar"),
80+
array("foo" . chr(10) . "bar"),
8181
);
8282
}
8383
}

0 commit comments

Comments
 (0)