You are here

function UserActionConfigSchemaTest::testValidUserActionConfigSchema in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Tests/UserActionConfigSchemaTest.php \Drupal\user\Tests\UserActionConfigSchemaTest::testValidUserActionConfigSchema()

Tests whether the user action config schema are valid.

File

core/modules/user/src/Tests/UserActionConfigSchemaTest.php, line 34
Contains \Drupal\user\Tests\UserActionConfigSchemaTest.

Class

UserActionConfigSchemaTest
Ensures the user action for adding and removing roles have valid config schema.

Namespace

Drupal\user\Tests

Code

function testValidUserActionConfigSchema() {
  $rid = strtolower($this
    ->randomMachineName(8));
  Role::create(array(
    'id' => $rid,
  ))
    ->save();

  // Test user_add_role_action configuration.
  $config = $this
    ->config('system.action.user_add_role_action.' . $rid);
  $this
    ->assertEqual($config
    ->get('id'), 'user_add_role_action.' . $rid);
  $this
    ->assertConfigSchema(\Drupal::service('config.typed'), $config
    ->getName(), $config
    ->get());

  // Test user_remove_role_action configuration.
  $config = $this
    ->config('system.action.user_remove_role_action.' . $rid);
  $this
    ->assertEqual($config
    ->get('id'), 'user_remove_role_action.' . $rid);
  $this
    ->assertConfigSchema(\Drupal::service('config.typed'), $config
    ->getName(), $config
    ->get());
}