ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
ConstraintViolationExceptionTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Tests\Refinery
;
22
23
use
ILIAS\Refinery\ConstraintViolationException
;
24
use
PHPUnit\Framework\TestCase
;
25
26
class
ConstraintViolationExceptionTest
extends
TestCase
27
{
28
public
function
testTranslationOfMessage
(): void
29
{
30
$callback =
function
(
string
$languageId):
string
{
31
$this->assertEquals(
'some_key'
, $languageId);
32
return
'Some text "%s" and "%s"'
;
33
};
34
35
try
{
36
throw
new
ConstraintViolationException
(
37
'This is an error message for developers'
,
38
'some_key'
,
39
'Value To Replace'
,
40
'Some important stuff'
41
);
42
}
catch
(
ConstraintViolationException
$exception) {
43
$this->assertEquals(
44
'Some text "Value To Replace" and "Some important stuff"'
,
45
$exception->
getTranslatedMessage
($callback)
46
);
47
48
$this->assertEquals(
49
'This is an error message for developers'
,
50
$exception->getMessage()
51
);
52
}
53
}
54
}
ILIAS\Tests\Refinery\ConstraintViolationExceptionTest\testTranslationOfMessage
testTranslationOfMessage()
Definition:
ConstraintViolationExceptionTest.php:28
ILIAS\Tests\Refinery\TestCase
Definition:
TestCase.php:58
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:29
ILIAS\Tests\Refinery\ConstraintViolationExceptionTest
Definition:
ConstraintViolationExceptionTest.php:26
ILIAS\Tests\Refinery
Definition:
ConstantTransformationTest.php:21
ILIAS\Refinery\ConstraintViolationException\getTranslatedMessage
getTranslatedMessage(callable $txt)
Definition:
ConstraintViolationException.php:52
TestCase
ConstraintViolationException
components
ILIAS
Refinery
tests
ConstraintViolationExceptionTest.php
Generated on Sun Aug 31 2025 23:03:32 for ILIAS by
1.8.13 (using
Doxyfile
)