respect-validation/tests/unit/ValidatorTest.php
2016-10-30 20:16:13 +01:00

39 lines
1,021 B
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;
use Respect\Validation\Exceptions\ComponentException;
class ValidatorTest extends \PHPUnit_Framework_TestCase
{
public function testStaticCreateShouldReturnNewValidator()
{
$this->assertInstanceOf(Validator::class, Validator::create());
}
public function testInvalidRuleClassShouldThrowComponentException()
{
$this->setExpectedException(ComponentException::class);
Validator::iDoNotExistSoIShouldThrowException();
}
/**
* Regression test #174.
*/
public function testShouldReturnValidatorInstanceWhenTheNotRuleIsCalledWithArguments()
{
$validator = new Validator();
$this->assertSame($validator, $validator->not($validator->notEmpty()));
}
}