ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTemplateTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3
14{
18 protected function setUp()
19 {
20 if (defined('ILIAS_PHPUNIT_CONTEXT')) {
21 require_once './Services/PHPUnit/classes/class.ilUnitUtil.php';
22 ilUnitUtil::performInitialisation();
23 } else {
24 chdir(dirname(__FILE__));
25 chdir('../../../');
26 }
27
28 // setup stub for global ilPluginAdmin
29 include_once("./Services/Component/classes/class.ilPluginAdmin.php");
30 global $ilPluginAdmin;
31 $ilPluginAdmin = $this->getMockBuilder('ilPluginAdmin')
32 ->getMock();
33 $ilPluginAdmin->method('getActivePluginsForSlot')
34 ->willReturn(array());
35 }
36
40 public function testilTemplateGet()
41 {
42 include_once("./Services/UICore/classes/class.ilTemplate.php");
43 $tpl = new ilTemplate("tpl.test_template_1.html", true, true, "Services/UICore/test");
44 $tpl->setVariable("CONTENT", "Hello World");
45
46 $actual = $tpl->get();
47
48 // Assert
49 $expected = "<b>Hello World</b>";
50 $this->assertEquals(
51 $actual,
52 $expected,
53 "ilTemplate get() not rendered properly."
54 );
55 }
56}
$tpl
Definition: ilias.php:10
An exception for terminatinating execution or to throw for unit testing.
Unit tests for template class.
testilTemplateGet()
@backupGlobals enabled
special template class to simplify handling of ITX/PEAR