ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTemplateTest Class Reference

Unit tests for template class. More...

+ Inheritance diagram for ilTemplateTest:
+ Collaboration diagram for ilTemplateTest:

Public Member Functions

 testilTemplateGet ()
 enabled More...
 

Protected Member Functions

 setUp ()
 Setup. More...
 

Detailed Description

Unit tests for template class.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Version
$Id$ needsInstalledILIAS

Definition at line 13 of file ilTemplateTest.php.

Member Function Documentation

◆ setUp()

ilTemplateTest::setUp ( )
protected

Setup.

Definition at line 18 of file ilTemplateTest.php.

References array, and defined.

19  {
20  if (defined('ILIAS_PHPUNIT_CONTEXT'))
21  {
22  require_once './Services/PHPUnit/classes/class.ilUnitUtil.php';
23  ilUnitUtil::performInitialisation();
24  }
25  else
26  {
27  chdir( dirname( __FILE__ ) );
28  chdir('../../../');
29  }
30 
31  // setup stub for global ilPluginAdmin
32  include_once("./Services/Component/classes/class.ilPluginAdmin.php");
33  global $ilPluginAdmin;
34  $ilPluginAdmin = $this->getMockBuilder('ilPluginAdmin')
35  ->getMock();
36  $ilPluginAdmin->method('getActivePluginsForSlot')
37  ->willReturn(array());
38  }
Create styles array
The data for the language used.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ testilTemplateGet()

ilTemplateTest::testilTemplateGet ( )

enabled

Definition at line 43 of file ilTemplateTest.php.

References $tpl.

44  {
45  include_once("./Services/UICore/classes/class.ilTemplate.php");
46  $tpl = new ilTemplate("tpl.test_template_1.html", true, true, "Services/UICore/test");
47  $tpl->setVariable("CONTENT", "Hello World");
48 
49  $actual = $tpl->get();
50 
51  // Assert
52  $expected = "<b>Hello World</b>";
53  $this->assertEquals(
54  $actual,
55  $expected,
56  "ilTemplate get() not rendered properly."
57  );
58  }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR

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