release 1.15.5 (#2848)

This commit is contained in:
Kevin Papst
2021-10-13 18:31:28 +02:00
committed by GitHub
parent 6b066046c6
commit bbf25823b8
7 changed files with 52 additions and 13 deletions

View File

@@ -0,0 +1,48 @@
<?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\Utils;
use App\Utils\CommandStyle;
use App\Validator\ValidationFailedException;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
/**
* @covers \App\Utils\CommandStyle
*/
class CommandStyleTest extends TestCase
{
public function testStyles()
{
$input = new ArrayInput([]);
$output = new BufferedOutput();
$sut = new CommandStyle($input, $output);
$sut->error('FooBar-Error');
$sut->warning('Hello-Warning');
$sut->success('World-Success');
$exception = new ValidationFailedException(new ConstraintViolationList([
new ConstraintViolation('123', null, [], $this, null, 123),
new ConstraintViolation('456', null, [], $this, null, 456),
]));
$sut->validationError($exception);
$result = $output->fetch();
self::assertStringContainsString('[ERROR] FooBar-Error', $result);
self::assertStringContainsString('[WARNING] Hello-Warning', $result);
self::assertStringContainsString('[OK] World-Success', $result);
self::assertStringContainsString('[ERROR] (123)', $result);
self::assertStringContainsString('[ERROR] (456)', $result);
}
}