ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Tests\Refinery\ConstraintViolationExceptionTest Class Reference
+ Inheritance diagram for ILIAS\Tests\Refinery\ConstraintViolationExceptionTest:
+ Collaboration diagram for ILIAS\Tests\Refinery\ConstraintViolationExceptionTest:

Public Member Functions

 testTranslationOfMessage ()
 
- Public Member Functions inherited from ILIAS\Tests\Refinery\TestCase
 getLanguage ()
 

Detailed Description

Definition at line 25 of file ConstraintViolationExceptionTest.php.

Member Function Documentation

◆ testTranslationOfMessage()

ILIAS\Tests\Refinery\ConstraintViolationExceptionTest::testTranslationOfMessage ( )

Definition at line 27 of file ConstraintViolationExceptionTest.php.

References ILIAS\Refinery\ConstraintViolationException\getTranslatedMessage().

27  : 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  }
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: