Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / user / tests / src / Kernel / UserActionConfigSchemaTest.php
1 <?php
2
3 namespace Drupal\Tests\user\Kernel;
4
5 use Drupal\Tests\SchemaCheckTestTrait;
6 use Drupal\KernelTests\KernelTestBase;
7 use Drupal\user\Entity\Role;
8
9 /**
10  * Ensures the user action for adding and removing roles have valid config
11  * schema.
12  *
13  * @group user
14  */
15 class UserActionConfigSchemaTest extends KernelTestBase {
16
17   use SchemaCheckTestTrait;
18
19   /**
20    * Modules to enable.
21    *
22    * @var array
23    */
24   public static $modules = ['system', 'user'];
25
26   /**
27    * Tests whether the user action config schema are valid.
28    */
29   public function testValidUserActionConfigSchema() {
30     $rid = strtolower($this->randomMachineName(8));
31     Role::create(['id' => $rid])->save();
32
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());
37
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());
42   }
43
44 }