mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 07:45:45 +01:00
46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Respect/Validation.
|
|
*
|
|
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
|
*
|
|
* For the full copyright and license information, please view the "LICENSE.md"
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Respect\Validation;
|
|
|
|
class ValidatorTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function testStaticCreateShouldReturnNewValidator()
|
|
{
|
|
$this->assertInstanceOf('Respect\Validation\Validator', Validator::create());
|
|
}
|
|
|
|
public function testInvalidRuleClassShouldThrowComponentException()
|
|
{
|
|
$this->setExpectedException('Respect\Validation\Exceptions\ComponentException');
|
|
Validator::iDoNotExistSoIShouldThrowException();
|
|
}
|
|
|
|
/**
|
|
* Regression test #174.
|
|
*/
|
|
public function testShouldReturnANewValidatorInstanceWhenTheNotRuleIsCalledWithoutAnyArgument()
|
|
{
|
|
$validator = new Validator();
|
|
|
|
$this->assertInstanceOf('Respect\Validation\Validator', $validator->not());
|
|
}
|
|
|
|
/**
|
|
* Regression test #174.
|
|
*/
|
|
public function testShouldReturnValidatorInstanceWhenTheNotRuleIsCalledWithArguments()
|
|
{
|
|
$validator = new Validator();
|
|
|
|
$this->assertSame($validator, $validator->not($validator->notEmpty()));
|
|
}
|
|
}
|