ILIAS  release_8 Revision v8.23
ilDidacticTemplatePatternTest Class Reference

Unit tests for class ilDidacticTemplate. More...

+ Inheritance diagram for ilDidacticTemplatePatternTest:
+ Collaboration diagram for ilDidacticTemplatePatternTest:

Public Member Functions

 testConstruct ()
 
 testMatches ()
 

Protected Member Functions

 setUp ()
 
 setGlobalVariable (string $name, $value)
 
 initPatternDependencies ()
 

Protected Attributes

Container $dic
 

Detailed Description

Unit tests for class ilDidacticTemplate.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 13 of file ilDidacticTemplatePatternTest.php.

Member Function Documentation

◆ initPatternDependencies()

ilDidacticTemplatePatternTest::initPatternDependencies ( )
protected

Definition at line 56 of file ilDidacticTemplatePatternTest.php.

References $dic, $GLOBALS, and setGlobalVariable().

Referenced by setUp().

56  : void
57  {
58  $this->dic = new Container();
59  $GLOBALS['DIC'] = $this->dic;
60 
61  $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
62 
63  $logger = $this->getMockBuilder(ilLogger::class)
64  ->disableOriginalConstructor()
65  ->getMock();
66 
67  $logger_factory = $this->getMockBuilder(ilLoggerFactory::class)
68  ->disableOriginalConstructor()
69  ->onlyMethods(['getComponentLogger'])
70  ->getMock();
71  $logger_factory->method('getComponentLogger')->willReturn($logger);
72  $this->setGlobalVariable('ilLoggerFactory', $logger_factory);
73  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGlobalVariable()

ilDidacticTemplatePatternTest::setGlobalVariable ( string  $name,
  $value 
)
protected

Definition at line 45 of file ilDidacticTemplatePatternTest.php.

References $c, $DIC, $GLOBALS, and $name.

Referenced by initPatternDependencies().

45  : void
46  {
47  global $DIC;
48 
49  $GLOBALS[$name] = $value;
50  unset($DIC[$name]);
51  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
52  return $value;
53  };
54  }
$c
Definition: cli.php:38
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the caller graph for this function:

◆ setUp()

ilDidacticTemplatePatternTest::setUp ( )
protected

Definition at line 17 of file ilDidacticTemplatePatternTest.php.

References initPatternDependencies().

17  : void
18  {
19  $this->initPatternDependencies();
20  parent::setUp();
21  }
+ Here is the call graph for this function:

◆ testConstruct()

ilDidacticTemplatePatternTest::testConstruct ( )

Definition at line 23 of file ilDidacticTemplatePatternTest.php.

23  : void
24  {
25  $include_pattern = new ilDidacticTemplateIncludeFilterPattern();
26  $this->assertInstanceOf(ilDidacticTemplateIncludeFilterPattern::class, $include_pattern);
27 
28  $exclude_pattern = new ilDidacticTemplateExcludeFilterPattern();
29  $this->assertInstanceOf(ilDidacticTemplateExcludeFilterPattern::class, $exclude_pattern);
30  }
Implementation of an include filter pattern for didactic template actions.
Implementation of an include filter pattern for didactic template actions.

◆ testMatches()

ilDidacticTemplatePatternTest::testMatches ( )

Definition at line 32 of file ilDidacticTemplatePatternTest.php.

References ilDidacticTemplateFilterPattern\PATTERN_SUBTYPE_REGEX.

32  : void
33  {
34  $include_pattern = new ilDidacticTemplateIncludeFilterPattern();
35  $include_pattern->setPatternSubType(ilDidacticTemplateFilterPattern::PATTERN_SUBTYPE_REGEX);
36  $include_pattern->setPattern('^il_crs_admin_[0-9]+$');
37  $this->assertTrue($include_pattern->valid('il_crs_admin_123'));
38 
39  $exclude_pattern = new ilDidacticTemplateExcludeFilterPattern();
40  $exclude_pattern->setPatternSubType(ilDidacticTemplateFilterPattern::PATTERN_SUBTYPE_REGEX);
41  $exclude_pattern->setPattern('il_crs_admin_[0-9]+');
42  $this->assertTrue($exclude_pattern->valid('il_grp_admin'));
43  }
Implementation of an include filter pattern for didactic template actions.
Implementation of an include filter pattern for didactic template actions.

Field Documentation

◆ $dic

Container ilDidacticTemplatePatternTest::$dic
protected

Definition at line 15 of file ilDidacticTemplatePatternTest.php.

Referenced by initPatternDependencies().


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