You are here

protected function LdapAuthenticationAdminFormTest::setUp in Lightweight Directory Access Protocol (LDAP) 8.4

Sets up the test.

Overrides BrowserTestBase::setUp

File

ldap_authentication/tests/src/Functional/LdapAuthenticationAdminFormTest.php, line 40

Class

LdapAuthenticationAdminFormTest
Test the admin form.

Namespace

Drupal\Tests\ldap_authentication\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $manager = $this->container
    ->get('entity_type.manager');
  $server = $manager
    ->getStorage('ldap_server')
    ->create([
    'id' => 'my_test_server_1',
    'label' => 'My Test Server 1',
    'timeout' => 30,
    'encryption' => 'none',
    'address' => 'example',
    'port' => 963,
    'basedn' => [
      'ou=people,dc=hogwarts,dc=edu',
    ],
    'user_attr' => 'cn',
    'unique_persistent_attr' => 'uid',
    'status' => TRUE,
    'mail_attr' => 'mail',
  ]);
  $server
    ->save();
  $server = $manager
    ->getStorage('ldap_server')
    ->create([
    'id' => 'my_test_server_2',
    'label' => 'My Test Server 2',
    'status' => TRUE,
    'basedn' => [
      'ou=people,dc=hogwarts,dc=edu',
    ],
  ]);
  $server
    ->save();
  $server = $manager
    ->getStorage('ldap_server')
    ->create([
    'id' => 'my_test_server_3',
    'label' => 'My FALSe Server 3',
    'status' => FALSE,
    'basedn' => [
      'ou=people,dc=hogwarts,dc=edu',
    ],
  ]);
  $server
    ->save();
}