ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCertificateValueReplacementTest Class Reference
+ Inheritance diagram for ilCertificateValueReplacementTest:
+ Collaboration diagram for ilCertificateValueReplacementTest:

Public Member Functions

 testReplace ()
 
 testReplaceClientWebDir ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilCertificateBaseTestCase
 setUp ()
 
 tearDown ()
 
 assertDoesNotThrow (callable $cb, string $message='')
 
 assertThrows (callable $cb, ?string $expected_class=null, ?string $expected_message=null)
 @template T of Throwable More...
 
 setGlobalVariable (string $name, mixed $value)
 
- Protected Attributes inherited from ilCertificateBaseTestCase
Container $dic
 

Detailed Description

Definition at line 21 of file ilCertificateValueReplacementTest.php.

Member Function Documentation

◆ testReplace()

ilCertificateValueReplacementTest::testReplace ( )

Definition at line 23 of file ilCertificateValueReplacementTest.php.

23 : void
24 {
25 $replacement = new ilCertificateValueReplacement();
26
27 $placeholderValues = ['NAME' => 'Peter', 'PRIZE' => 'a fantastic prize'];
28
29 $certificateContent = '<xml>
30[BACKGROUND_IMAGE]
31Hurray [NAME] you have received [PRIZE]
32</xml>';
33
34 $replacedContent = $replacement->replace($placeholderValues, $certificateContent);
35
36 $expected = '<xml>
37[BACKGROUND_IMAGE]
38Hurray Peter you have received a fantastic prize
39</xml>';
40
41 $this->assertSame($expected, $replacedContent);
42 }

◆ testReplaceClientWebDir()

ilCertificateValueReplacementTest::testReplaceClientWebDir ( )

Definition at line 44 of file ilCertificateValueReplacementTest.php.

44 : void
45 {
46 $replacement = new ilCertificateValueReplacement();
47
48 $placeholderValues = ['NAME' => 'Peter', 'PRIZE' => 'a fantastic prize'];
49
50 $certificateContent = '<xml>
51[BACKGROUND_IMAGE]
52[CLIENT_WEB_DIR]/background.jpg
53Hurray [NAME] you have received [PRIZE]
54</xml>';
55
56 $replacedContent = $replacement->replace($placeholderValues, $certificateContent);
57
58 $expected = '<xml>
59[BACKGROUND_IMAGE]
60[CLIENT_WEB_DIR]/background.jpg
61Hurray Peter you have received a fantastic prize
62</xml>';
63
64 $this->assertSame($expected, $replacedContent);
65 }

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