You are here

protected function PermissionHandlerTest::mockModuleExtension in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\PermissionHandlerTest::mockModuleExtension()
  2. 10 core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\PermissionHandlerTest::mockModuleExtension()

Provides an extension object for a given module with a human name.

Parameters

string $module: The module machine name.

string $name: The module human name.

Return value

\Drupal\Core\Extension\Extension The extension object.

3 calls to PermissionHandlerTest::mockModuleExtension()
PermissionHandlerTest::testBuildPermissionsYaml in core/modules/user/tests/src/Unit/PermissionHandlerTest.php
Tests permissions provided by YML files.
PermissionHandlerTest::testBuildPermissionsYamlCallback in core/modules/user/tests/src/Unit/PermissionHandlerTest.php
Tests dynamic callback permissions provided by YML files.
PermissionHandlerTest::testPermissionsYamlStaticAndCallback in core/modules/user/tests/src/Unit/PermissionHandlerTest.php
Tests a YAML file containing both static permissions and a callback.

File

core/modules/user/tests/src/Unit/PermissionHandlerTest.php, line 78
Contains \Drupal\Tests\user\Unit\PermissionHandlerTest.

Class

PermissionHandlerTest
Tests the permission handler.

Namespace

Drupal\Tests\user\Unit

Code

protected function mockModuleExtension($module, $name) {
  $extension = new Extension('vfs:/', $module, "modules/{$module}");
  $extension->info['name'] = $name;
  return $extension;
}