mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 07:15:45 +01:00
The changes you see in this commit had to be made due to the upgrade of PHPunit version. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
48 lines
1.4 KiB
PHP
48 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\Exceptions;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* @covers \Respect\Validation\Exceptions\NestedValidationException
|
|
*/
|
|
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());
|
|
}
|
|
}
|