ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCertificateValueReplacementTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
9 public function testReplace()
10 {
11 $replacement = new ilCertificateValueReplacement('/some/where');
12
13 $placeholderValues = array('NAME' => 'Peter', 'PRIZE' => 'a fantastic prize');
14
15 $certificateContent = '<xml>
16[BACKGROUND_IMAGE]
17Hurray [NAME] you have received [PRIZE]
18</xml>';
19
20 $replacedContent = $replacement->replace($placeholderValues, $certificateContent);
21
22 $expected = '<xml>
23[BACKGROUND_IMAGE]
24Hurray Peter you have received a fantastic prize
25</xml>';
26
27 $this->assertEquals($expected, $replacedContent);
28 }
29
30 public function testReplaceClientWebDir()
31 {
32 $replacement = new ilCertificateValueReplacement('/some/where');
33
34 $placeholderValues = array('NAME' => 'Peter', 'PRIZE' => 'a fantastic prize');
35
36 $certificateContent = '<xml>
37[BACKGROUND_IMAGE]
38[CLIENT_WEB_DIR]/background.jpg
39Hurray [NAME] you have received [PRIZE]
40</xml>';
41
42 $replacedContent = $replacement->replace($placeholderValues, $certificateContent);
43
44 $expected = '<xml>
45[BACKGROUND_IMAGE]
46[CLIENT_WEB_DIR]/background.jpg
47Hurray Peter you have received a fantastic prize
48</xml>';
49
50 $this->assertEquals($expected, $replacedContent);
51 }
52}
An exception for terminatinating execution or to throw for unit testing.
Class ilCertificateBaseTestCase.