Definition at line 27 of file ilUtilTest.php.
 
◆ mockClickableCall()
  
  
      
        
          | ilUtilTest::mockClickableCall  | 
          ( | 
          string  | 
          $input,  | 
         
        
           | 
           | 
          string  | 
          $transformed  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Definition at line 171 of file ilUtilTest.php.
References $container, and ILIAS\UI\examples\Layout\Page\Standard\$refinery.
Referenced by testMakeClickableWithGotoLinksAndInvalidRefId(), and testMakeClickableWithoutGotoLinks().
  173         $transformation = $this->getMockBuilder(Transformation::class)->getMock();
   174         $transformation->expects(self::once())->method(
'transform')->with($input)->willReturn($transformed);
   176         $string_group = $this->getMockBuilder(StringGroup::class)->disableOriginalConstructor()->getMock();
   177         $string_group->expects(self::once())->method(
'makeClickable')->willReturn($transformation);
   179         $refinery = $this->getMockBuilder(Refinery::class)->disableOriginalConstructor()->getMock();
   180         $refinery->expects(self::once())->method(
'string')->willReturn($string_group);
   182         $container = $this->getMockBuilder(Container::class)->disableOriginalConstructor()->getMock();
 
Customizing of pimple-DIC for ILIAS. 
 
 
 
 
◆ provideGotoLinkData()
  
  
      
        
          | static ilUtilTest::provideGotoLinkData  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Definition at line 102 of file ilUtilTest.php.
  108             'Test with empty string.' => [
'', 
'', [], []],
   109             'Test with correct link and target = _self is added.' => [
   110                 'A link to <a href="%scrs_345%s" target="_self">a course</a>.',
   111                 'A link to <a href="%scrs_345%s">somewhere</a>.',
   115             'Test with multiple correct links.' => [
   116                 'A link to <a href="%scrs_345%s" target="_self">a course</a> and to <a href="%scrs_87%s" target="_self">another course</a>.',
   117                 'A link to <a href="%scrs_345%s">somewhere</a> and to <a href="%scrs_87%s">somewhere else</a>.',
   118                 [345 => 5, 87 => 45],
   119                 [5 => 
'a course', 45 => 
'another course'],
   121             'Test links with invalid ref id.' => [
   122                 'A link to <a href="%scrs_345%s">somewhere</a>.',
   123                 'A link to <a href="%scrs_345%s">somewhere</a>.',
   127             'The target attribute is REPLACED with _self.' => [
   128                 'A link to <a href="%scrs_345%s" target="_self">some course</a>.',
   129                 'A link to <a target="bogus target" href="%scrs_345%s">somewhere</a>.',
   131                 [8 => 
'some course'],
   133             'The attributes position does not matter, it is always replaced with target="_self".' => [
   134                 'A link to <a href="%scrs_345%s" target="_self">some course</a>.',
   135                 'A link to <a href="%scrs_345%s" target="bogus target">somewhere</a>.',
   137                 [8 => 
'some course'],
   139             'All attributes are removed from the link.' => [
   140                 'A link to <a href="%scrs_345%s" target="_self">some course</a>.',
   141                 'A link to <a href="%scrs_345%s" class="very-important-css-class">somewhere</a>.',
   143                 [8 => 
'some course'],
   148             'With goto.php: ' => [
'http://localhost/goto.php?target=', 
''],
   149             'With goto_*.html: ' => [
'http://localhost/goto_', 
'.html'],
   152         $repeatForFormat = 
function (
string $format, array $values): array {
   154                 ...array_fill(0, (count(explode(
'%s', $format)) - 1) / 2, $values)
   159         foreach ($linkFormats as $name => $args) {
   160             foreach ($tests as $key => $array) {
   161                 $allTests[$name . $key] = array_merge([
   162                     sprintf($array[0], ...$repeatForFormat($array[0], $args)),
   163                     sprintf($array[1], ...$repeatForFormat($array[1], $args)),
   164                 ], array_slice($array, 2));
  
 
 
◆ setUp()
Definition at line 29 of file ilUtilTest.php.
   32         if (!defined(
"ILIAS_HTTP_PATH")) {
    33             define(
"ILIAS_HTTP_PATH", 
"http://localhost");
  
 
 
◆ testMakeClickableWithGotoLinksAndInvalidRefId()
      
        
          | ilUtilTest::testMakeClickableWithGotoLinksAndInvalidRefId  | 
          ( | 
          string  | 
          $expected,  | 
        
        
           | 
           | 
          string  | 
          $input,  | 
        
        
           | 
           | 
          array  | 
          $ref_to_obj,  | 
        
        
           | 
           | 
          array  | 
          $obj_to_title  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
provideGotoLinkData 
Definition at line 55 of file ilUtilTest.php.
References $container, $GLOBALS, $id, ilUtil\makeClickable(), and mockClickableCall().
   57         $wrap_array = 
static fn(array $array): array => (
    63         $cache = $this->getMockBuilder(ilObjectDataCache::class)->disableOriginalConstructor()->getMock();
    66         foreach($ref_to_obj as $k => $v) {
    67             $consecutive_id[] = [$k, $v];
    69         $cache->expects(self::exactly(count($ref_to_obj)))
    70             ->method(
'lookupObjId')
    72                 function (
$id) use (&$consecutive_id) {
    73                     list($k, $v) = array_shift($consecutive_id);
    74                     $this->assertEquals($k, 
$id);
    79         $consecutive_title = [];
    80         foreach($obj_to_title as $k => $v) {
    81             $consecutive_title[] = [$k, $v];
    83         $cache->expects(self::exactly(count($obj_to_title)))
    84             ->method(
'lookupTitle')
    86                 function (
$id) use (&$consecutive_title) {
    87                     list($k, $v) = array_shift($consecutive_title);
    88                     $this->assertEquals($k, 
$id);
    93         $container->expects(self::exactly(count($ref_to_obj)))->method(
'offsetGet')->with(
'ilObjDataCache')->willReturn($cache);
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
mockClickableCall(string $input, string $transformed)
 
static makeClickable(string $a_text, bool $detectGotoLinks=false)
 
 
 
 
◆ testMakeClickableWithoutGotoLinks()
      
        
          | ilUtilTest::testMakeClickableWithoutGotoLinks  | 
          ( | 
           | ) | 
           | 
        
      
 
 
The documentation for this class was generated from the following file: