trait GroupIncludesTestTrait

@coversDefaultClass \Drupal\Core\Hook\HookCollectorPass
@group Hook

Hierarchy

2 files declare their use of GroupIncludesTestTrait
HookCollectorPassTest.php in core/tests/Drupal/Tests/Core/Hook/HookCollectorPassTest.php
ModuleHandlerTest.php in core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php

File

core/tests/Drupal/Tests/Core/GroupIncludesTestTrait.php, line 13

Namespace

Drupal\Tests\Core
View source
trait GroupIncludesTestTrait {
  const GROUP_INCLUDES = [
    'token_info' => [
      'vfs://drupal_root/test_module.tokens.inc',
    ],
  ];
  
  /**
   * @return array[]
   *   An array of module filenames mapped to their virtual file system paths.
   */
  public static function setupGroupIncludes() : array {
    vfsStream::setup('drupal_root');
    file_put_contents('vfs://drupal_root/test_module_info.yml', '');
    $module_filenames = [
      'test_module' => [
        'pathname' => 'vfs://drupal_root/test_module_info.yml',
      ],
    ];
    file_put_contents('vfs://drupal_root/test_module.module', <<<'EOD'
<?php

function test_module_hook_info(): array {
  $hooks['token_info'] = [
    'group' => 'tokens',
  ];
  return $hooks;
}

EOD
);
    file_put_contents('vfs://drupal_root/test_module.tokens.inc', <<<'EOD'
<?php

function _test_module_helper() {}

EOD
);
    return $module_filenames;
  }

}

Members

Title Sort descending Modifiers Object type Summary
GroupIncludesTestTrait::GROUP_INCLUDES constant
GroupIncludesTestTrait::setupGroupIncludes public static function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.