ILIAS  release_7 Revision v7.30-3-g800a261c036
ConstraintViolationExceptionTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
5
10{
11 public function testTranslationOfMessage()
12 {
13 $that = $this;
14 $callback = function ($languageId) use ($that) {
15 $that->assertEquals('some_key', $languageId);
16 return 'Some text "%s" and "%s"';
17 };
18
19 try {
20 throw new \ILIAS\Refinery\ConstraintViolationException(
21 'This is an error message for developers',
22 'some_key',
23 'Value To Replace',
24 'Some important stuff'
25 );
26 } catch (\ILIAS\Refinery\ConstraintViolationException $exception) {
27 $this->assertEquals(
28 'Some text "Value To Replace" and "Some important stuff"',
29 $exception->getTranslatedMessage($callback)
30 );
31
32 $this->assertEquals(
33 'This is an error message for developers',
34 $exception->getMessage()
35 );
36 }
37 }
38}
An exception for terminatinating execution or to throw for unit testing.
Class ChatMainBarProvider \MainMenu\Provider.