ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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]
17 Hurray [NAME] you have received [PRIZE]
18 </xml>';
19 
20  $replacedContent = $replacement->replace($placeholderValues, $certificateContent);
21 
22  $expected = '<xml>
23 [BACKGROUND_IMAGE]
24 Hurray 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
39 Hurray [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
47 Hurray Peter you have received a fantastic prize
48 </xml>';
49 
50  $this->assertEquals($expected, $replacedContent);
51  }
52 }