0
0
mirror of https://github.com/kevinpapst/kimai2.git synced 2024-12-22 12:18:29 +00:00
kevinpapst_kimai2/tests/Validator/ValidationFailedExceptionTest.php
2024-02-07 23:47:25 +01:00

39 lines
1.1 KiB
PHP

<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Validator;
use App\Validator\ValidationFailedException;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\ConstraintViolationList;
/**
* @covers \App\Validator\ValidationFailedException
*/
class ValidationFailedExceptionTest extends TestCase
{
public function testException(): void
{
$list = new ConstraintViolationList();
$sut = new ValidationFailedException($list);
self::assertEquals(400, $sut->getCode());
self::assertEquals('Validation failed', $sut->getMessage());
self::assertSame($list, $sut->getViolations());
}
public function testConstruct(): void
{
$list = new ConstraintViolationList();
$sut = new ValidationFailedException($list, 'Something went wrong');
self::assertEquals(400, $sut->getCode());
self::assertEquals('Something went wrong', $sut->getMessage());
self::assertSame($list, $sut->getViolations());
}
}