32710836 |
1 | <?php |
2 | |
3 | /** |
4 | * Class CRM_Core_SessionTest |
5 | * @group headless |
6 | */ |
7 | class CRM_Core_SessionTest extends CiviUnitTestCase { |
8 | |
faba1457 |
9 | public function setUp(): void { |
32710836 |
10 | CRM_Core_Smarty::singleton()->clearTemplateVars(); |
11 | } |
12 | |
13 | /** |
14 | * Test that the template setStatus uses gives reasonable output. |
15 | * Test with text only. |
16 | */ |
17 | public function testSetStatusWithTextOnly() { |
18 | $smarty = CRM_Core_Smarty::singleton(); |
19 | $smarty->assign('infoMessage', 'Your refridgerator door is open.'); |
20 | $output = $smarty->fetch('CRM/common/info.tpl'); |
21 | $this->assertStringContainsString('Your refridgerator door is open.', $output); |
22 | } |
23 | |
24 | /** |
25 | * Test that the template setStatus uses gives reasonable output. |
26 | * Test with title only. |
27 | */ |
28 | public function testSetStatusWithTitleOnly() { |
29 | $smarty = CRM_Core_Smarty::singleton(); |
30 | $smarty->assign('infoTitle', 'Error Error Error.'); |
31 | $output = $smarty->fetch('CRM/common/info.tpl'); |
32 | $this->assertStringContainsString('Error Error Error.', $output); |
33 | } |
34 | |
35 | /** |
36 | * Test that the template setStatus uses gives reasonable output. |
37 | * Test with both text and title. |
38 | */ |
39 | public function testSetStatusWithBoth() { |
40 | $smarty = CRM_Core_Smarty::singleton(); |
41 | $smarty->assign('infoTitle', 'Spoiler alert!'); |
42 | $smarty->assign('infoMessage', 'Your refridgerator door is open.'); |
43 | $output = $smarty->fetch('CRM/common/info.tpl'); |
44 | $this->assertStringContainsString('Spoiler alert!', $output); |
45 | $this->assertStringContainsString('Your refridgerator door is open.', $output); |
46 | } |
47 | |
48 | } |