ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 29 of file ilDidacticTemplatePatternTest.php.

Member Function Documentation

◆ initPatternDependencies()

ilDidacticTemplatePatternTest::initPatternDependencies ( )
protected

Definition at line 72 of file ilDidacticTemplatePatternTest.php.

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

Referenced by setUp().

72  : void
73  {
74  $this->dic = new Container();
75  $GLOBALS['DIC'] = $this->dic;
76 
77  $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
78 
79  $logger = $this->getMockBuilder(ilLogger::class)
80  ->disableOriginalConstructor()
81  ->getMock();
82 
83  $logger_factory = $this->getMockBuilder(ilLoggerFactory::class)
84  ->disableOriginalConstructor()
85  ->onlyMethods(['getComponentLogger'])
86  ->getMock();
87  $logger_factory->method('getComponentLogger')->willReturn($logger);
88  $this->setGlobalVariable('ilLoggerFactory', $logger_factory);
89  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:53
+ 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 61 of file ilDidacticTemplatePatternTest.php.

References $c, $DIC, and $GLOBALS.

Referenced by initPatternDependencies().

61  : void
62  {
63  global $DIC;
64 
65  $GLOBALS[$name] = $value;
66  unset($DIC[$name]);
67  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
68  return $value;
69  };
70  }
$c
Definition: deliver.php:25
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ setUp()

ilDidacticTemplatePatternTest::setUp ( )
protected

Definition at line 33 of file ilDidacticTemplatePatternTest.php.

References initPatternDependencies().

33  : void
34  {
35  $this->initPatternDependencies();
36  parent::setUp();
37  }
+ Here is the call graph for this function:

◆ testConstruct()

ilDidacticTemplatePatternTest::testConstruct ( )

Definition at line 39 of file ilDidacticTemplatePatternTest.php.

39  : void
40  {
41  $include_pattern = new ilDidacticTemplateIncludeFilterPattern();
42  $this->assertInstanceOf(ilDidacticTemplateIncludeFilterPattern::class, $include_pattern);
43 
44  $exclude_pattern = new ilDidacticTemplateExcludeFilterPattern();
45  $this->assertInstanceOf(ilDidacticTemplateExcludeFilterPattern::class, $exclude_pattern);
46  }
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 48 of file ilDidacticTemplatePatternTest.php.

References ilDidacticTemplateFilterPattern\PATTERN_SUBTYPE_REGEX.

48  : void
49  {
50  $include_pattern = new ilDidacticTemplateIncludeFilterPattern();
51  $include_pattern->setPatternSubType(ilDidacticTemplateFilterPattern::PATTERN_SUBTYPE_REGEX);
52  $include_pattern->setPattern('^il_crs_admin_[0-9]+$');
53  $this->assertTrue($include_pattern->valid('il_crs_admin_123'));
54 
55  $exclude_pattern = new ilDidacticTemplateExcludeFilterPattern();
56  $exclude_pattern->setPatternSubType(ilDidacticTemplateFilterPattern::PATTERN_SUBTYPE_REGEX);
57  $exclude_pattern->setPattern('il_crs_admin_[0-9]+');
58  $this->assertTrue($exclude_pattern->valid('il_grp_admin'));
59  }
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 31 of file ilDidacticTemplatePatternTest.php.

Referenced by initPatternDependencies().


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