mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
This commit will make sure that every class, interface, or trait will have the "@author" annotation in it. In order to create a list of authors, I used the "git blame" command, which means that if someone changed or even created the file but does not have any remaining line will not be shown in the list; it's a trade-off worth but it is worth it. The other way to do it would be carefully checking each file. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
52 lines
1.6 KiB
PHP
52 lines
1.6 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\Exceptions;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* @covers \Respect\Validation\Exceptions\NestedValidationException
|
|
*
|
|
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
|
* @author Gabriel Caruso <carusogabriel34@gmail.com>
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
*/
|
|
class NestedValidationExceptionTest extends TestCase
|
|
{
|
|
/**
|
|
* @test
|
|
*/
|
|
public function getChildrenShouldReturnExceptionAddedByAddRelated(): void
|
|
{
|
|
$composite = new AttributeException('input', 'id', [], 'trim');
|
|
$node = new IntValException('input', 'id', [], 'trim');
|
|
$composite->addChild($node);
|
|
self::assertCount(1, $composite->getChildren(true));
|
|
self::assertContainsOnly(IntValException::class, $composite->getChildren());
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function addingTheSameInstanceShouldAddJustASingleReference(): void
|
|
{
|
|
$composite = new AttributeException('input', 'id', [], 'trim');
|
|
$node = new IntValException('input', 'id', [], 'trim');
|
|
$composite->addChild($node);
|
|
$composite->addChild($node);
|
|
$composite->addChild($node);
|
|
self::assertCount(1, $composite->getChildren(true));
|
|
self::assertContainsOnly(IntValException::class, $composite->getChildren());
|
|
}
|
|
}
|