public function LdapAuthorizationProviderTest::testValidateRowForm in Lightweight Directory Access Protocol (LDAP) 8.4
Test regex validation().
File
- ldap_authorization/
tests/ src/ Unit/ LdapAuthorizationProviderTest.php, line 38
Class
- LdapAuthorizationProviderTest
- @coversDefaultClass \Drupal\ldap_authorization\Plugin\authorization\Provider\LDAPAuthorizationProvider @group authorization
Namespace
Drupal\Tests\ldap_authorization\UnitCode
public function testValidateRowForm() : void {
$form_state = new FormState();
$mappings = [
0 => [
'provider_mappings' => [
'is_regex' => 1,
'query' => 'example',
],
],
1 => [
'provider_mappings' => [
'is_regex' => 1,
'query' => '/.*/',
],
],
2 => [
'provider_mappings' => [
'is_regex' => 0,
'query' => '/.*/',
],
],
];
$form_state
->setUserInput($mappings);
$sub_form_state = new SubFormState($form_state, [
'provider_config',
]);
$form = [];
$this->providerPlugin
->validateRowForm($form, $sub_form_state);
self::assertEquals([], $sub_form_state
->getErrors());
// @todo Still needs more useful assertions here.
}