ILIAS  release_7 Revision v7.30-3-g800a261c036
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
4use PHPUnit\Framework\TestCase;
5
15class ilTemplateTest extends TestCase
16{
20 protected function setUp() : void
21 {
22 if (defined('ILIAS_PHPUNIT_CONTEXT')) {
23 require_once './Services/PHPUnit/classes/class.ilUnitUtil.php';
24 ilUnitUtil::performInitialisation();
25 } else {
26 chdir(dirname(__FILE__));
27 chdir('../../../');
28 }
29
30 // setup stub for global ilPluginAdmin
31 include_once("./Services/Component/classes/class.ilPluginAdmin.php");
32 global $ilPluginAdmin;
33 $ilPluginAdmin = $this->getMockBuilder('ilPluginAdmin')
34 ->getMock();
35 $ilPluginAdmin->method('getActivePluginsForSlot')
36 ->willReturn(array());
37 }
38
42 public function testilTemplateGet()
43 {
44 include_once("./Services/UICore/classes/class.ilTemplate.php");
45 $tpl = new ilTemplate("tpl.test_template_1.html", true, true, "Services/UICore/test");
46 $tpl->setVariable("CONTENT", "Hello World");
47
48 $actual = $tpl->get();
49
50 // Assert
51 $expected = "<b>Hello World</b>";
52 $this->assertEquals(
53 $actual,
54 $expected,
55 "ilTemplate get() not rendered properly."
56 );
57 }
58}
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
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41