mirror of
https://github.com/Respect/Validation.git
synced 2026-03-18 08:09:51 +01:00
Whenever is possible it is better to declare our classes as final. The PHPUnit tests should not be extended, therefore there is no reason for them to not be final. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
57 lines
1.4 KiB
PHP
57 lines
1.4 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.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation;
|
|
|
|
use Respect\Validation\Exceptions\ComponentException;
|
|
use Respect\Validation\Test\TestCase;
|
|
|
|
/**
|
|
* @covers \Respect\Validation\Validator
|
|
*
|
|
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
|
* @author Gabriel Caruso <carusogabriel34@gmail.com>
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
* @author Nick Lombard <github@jigsoft.co.za>
|
|
*/
|
|
final class ValidatorTest extends TestCase
|
|
{
|
|
/**
|
|
* @test
|
|
*/
|
|
public function staticCreateShouldReturnNewValidator(): void
|
|
{
|
|
self::assertInstanceOf(Validator::class, Validator::create());
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function invalidRuleClassShouldThrowComponentException(): void
|
|
{
|
|
$this->expectException(ComponentException::class);
|
|
Validator::iDoNotExistSoIShouldThrowException();
|
|
}
|
|
|
|
/**
|
|
* Regression test #174.
|
|
*
|
|
* @test
|
|
*/
|
|
public function shouldReturnValidatorInstanceWhenTheNotRuleIsCalledWithArguments(): void
|
|
{
|
|
$validator = new Validator();
|
|
|
|
self::assertSame($validator, $validator->not($validator->notEmpty()));
|
|
}
|
|
}
|