mirror of
https://github.com/Respect/Validation.git
synced 2024-06-03 06:12:17 +02:00
ab3732f91f
SPDX IDs are shorter than licensing notes previously used, and adhere better to FOSS standards. It is also machine-readable.
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
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 <alganet@gmail.com>
|
|
* @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()));
|
|
}
|
|
}
|