mirror of
https://github.com/Respect/Validation.git
synced 2024-06-29 02:30:06 +02:00
Refactor unit tests for "Slug" rule
This commit is contained in:
parent
7aa32658e6
commit
c9bd83f111
|
@ -14,35 +14,27 @@ namespace Respect\Validation\Rules;
|
|||
/**
|
||||
* @group rule
|
||||
* @covers Respect\Validation\Rules\Slug
|
||||
* @covers Respect\Validation\Exceptions\SlugException
|
||||
*/
|
||||
class SlugTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $slug;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->slug = new Slug();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerValidSlug
|
||||
*/
|
||||
public function testValidSlug($input)
|
||||
{
|
||||
$this->assertTrue($this->slug->__invoke($input));
|
||||
$this->assertTrue($this->slug->check($input));
|
||||
$this->assertTrue($this->slug->assert($input));
|
||||
$rule = new Slug();
|
||||
|
||||
$this->assertTrue($rule->validate($input));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerInvalidSlug
|
||||
* @expectedException Respect\Validation\Exceptions\SlugException
|
||||
*/
|
||||
public function testInvalidSlug($input)
|
||||
{
|
||||
$this->assertFalse($this->slug->__invoke($input));
|
||||
$this->assertFalse($this->slug->assert($input));
|
||||
$rule = new Slug();
|
||||
|
||||
$this->assertFalse($rule->validate($input));
|
||||
}
|
||||
|
||||
public function providerValidSlug()
|
||||
|
|
Loading…
Reference in a new issue