ILIAS
release_8 Revision v8.23
◀ ilDoc Overview
ConstraintViolationExceptionTest.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
4
21
namespace
ILIAS\Tests\Refinery
;
22
23
use
ILIAS\Refinery\ConstraintViolationException
;
24
25
class
ConstraintViolationExceptionTest
extends
TestCase
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
{
35
throw
new
ConstraintViolationException
(
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
}
ILIAS\Tests\Refinery\ConstraintViolationExceptionTest\testTranslationOfMessage
testTranslationOfMessage()
Definition:
ConstraintViolationExceptionTest.php:27
ILIAS\Tests\Refinery\TestCase
Definition:
TestCase.php:52
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:29
ILIAS\Tests\Refinery\ConstraintViolationExceptionTest
Definition:
ConstraintViolationExceptionTest.php:25
ILIAS\Tests\Refinery
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
ConstantTransformationTest.php:21
ILIAS\Refinery\ConstraintViolationException\getTranslatedMessage
getTranslatedMessage(callable $txt)
Definition:
ConstraintViolationException.php:52
ConstraintViolationException
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
tests
Refinery
ConstraintViolationExceptionTest.php
Generated on Sun Aug 31 2025 22:02:50 for ILIAS by
1.8.13 (using
Doxyfile
)