ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 26 of file ConstraintViolationExceptionTest.php.

Member Function Documentation

◆ testTranslationOfMessage()

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

Definition at line 28 of file ConstraintViolationExceptionTest.php.

References ILIAS\Refinery\ConstraintViolationException\getTranslatedMessage().

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

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