ILIAS  release_8 Revision v8.24
ConstraintViolationExceptionTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21namespace ILIAS\Tests\Refinery;
22
24
26{
27 public function testTranslationOfMessage(): void
28 {
29 $callback = function (string $languageId): string {
30 $this->assertEquals('some_key', $languageId);
31 return 'Some text "%s" and "%s"';
32 };
33
34 try {
36 'This is an error message for developers',
37 'some_key',
38 'Value To Replace',
39 'Some important stuff'
40 );
41 } catch (ConstraintViolationException $exception) {
42 $this->assertEquals(
43 'Some text "Value To Replace" and "Some important stuff"',
44 $exception->getTranslatedMessage($callback)
45 );
46
47 $this->assertEquals(
48 'This is an error message for developers',
49 $exception->getMessage()
50 );
51 }
52 }
53}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...