3 namespace Drupal\Tests\user\Kernel;
5 use Drupal\Tests\SchemaCheckTestTrait;
6 use Drupal\KernelTests\KernelTestBase;
7 use Drupal\user\Entity\Role;
10 * Ensures the user action for adding and removing roles have valid config
15 class UserActionConfigSchemaTest extends KernelTestBase {
17 use SchemaCheckTestTrait;
24 public static $modules = ['system', 'user'];
27 * Tests whether the user action config schema are valid.
29 public function testValidUserActionConfigSchema() {
30 $rid = strtolower($this->randomMachineName(8));
31 Role::create(['id' => $rid])->save();
33 // Test user_add_role_action configuration.
34 $config = $this->config('system.action.user_add_role_action.' . $rid);
35 $this->assertEqual($config->get('id'), 'user_add_role_action.' . $rid);
36 $this->assertConfigSchema(\Drupal::service('config.typed'), $config->getName(), $config->get());
38 // Test user_remove_role_action configuration.
39 $config = $this->config('system.action.user_remove_role_action.' . $rid);
40 $this->assertEqual($config->get('id'), 'user_remove_role_action.' . $rid);
41 $this->assertConfigSchema(\Drupal::service('config.typed'), $config->getName(), $config->get());