function UserConfigValidationTest::testUserSettings

Tests invalid values in 'user.settings' config properties.

@dataProvider providerTestUserSettings

File

core/modules/user/tests/src/Kernel/UserConfigValidationTest.php, line 59

Class

UserConfigValidationTest
Tests validating user modules' configuration.

Namespace

Drupal\Tests\user\Kernel

Code

public function testUserSettings($property, $property_value, $expected_message) : void {
    $config_name = 'user.settings';
    $config = $this->config($config_name);
    $violations = $this->container
        ->get('config.typed')
        ->createFromNameAndData($config_name, $config->set($property, $property_value)
        ->get())
        ->validate();
    $this->assertCount(1, $violations);
    $this->assertSame($property, $violations[0]->getPropertyPath());
    $this->assertSame($expected_message, (string) $violations[0]->getMessage());
}

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