Skip to content

Commit

Permalink
Merge pull request #243 from alganet/0.7
Browse files Browse the repository at this point in the history
Removing undocumented 'base' shortcut, fixing PrntTest
  • Loading branch information
henriquemoody committed Jan 14, 2015
2 parents 0b3012b + a8d1c94 commit 54c61f0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 37 deletions.
5 changes: 0 additions & 5 deletions library/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
30 changes: 0 additions & 30 deletions tests/library/Respect/Validation/Rules/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ class BaseTest extends \PHPUnit_Framework_TestCase
{
protected $object;

protected function setUp()
{

}

/**
* @dataProvider providerForBase
*
Expand All @@ -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
*
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/library/Respect/Validation/Rules/PrntTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
);
}
}
Expand Down

0 comments on commit 54c61f0

Please sign in to comment.