You are here

public function FieldProviderTest::setUp in Lightweight Directory Access Protocol (LDAP) 8.4

Overrides KernelTestBase::setUp

File

ldap_user/tests/src/Kernel/FieldProviderTest.php, line 47

Class

FieldProviderTest
Field Provider tests.

Namespace

Drupal\Tests\ldap_user\Kernel

Code

public function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('ldap_server');
  $this
    ->installEntitySchema('user');
  $this
    ->installConfig('ldap_user');
  $this->server = Server::create([
    'id' => 'example',
    'picture_attr' => 'picture_field',
    'user_attr' => 'cn',
    'mail_attr' => 'mail',
    'unique_persistent_attr' => 'guid',
    'drupalAcctProvisionServer' => 'example',
  ]);
  $this->data = [
    'drupal' => [
      'field-test_field' => [
        'ldap_attr' => '[cn]',
        'user_attr' => '[field.test_field]',
        'convert' => FALSE,
        'user_tokens' => '',
        'config_module' => 'ldap_user',
        'prov_module' => 'ldap_user',
        'prov_events' => [
          self::EVENT_CREATE_DRUPAL_USER,
        ],
      ],
      'property-name' => [
        'ldap_attr' => '[cn]',
        'user_attr' => '[property.name]',
        'convert' => TRUE,
        'user_tokens' => '',
        'config_module' => 'ldap_user',
        'prov_module' => 'ldap_user',
        'prov_events' => [
          self::EVENT_CREATE_DRUPAL_USER,
          self::EVENT_SYNC_TO_DRUPAL_USER,
        ],
      ],
    ],
    'ldap' => [
      'userPassword' => [
        'ldap_attr' => '[userPassword]',
        'user_attr' => '[password.user-only]',
        'convert' => FALSE,
        'user_tokens' => '',
        'config_module' => 'ldap_user',
        'prov_module' => 'ldap_user',
        'prov_events' => [
          self::EVENT_CREATE_LDAP_ENTRY,
          self::EVENT_SYNC_TO_LDAP_ENTRY,
        ],
      ],
      'property-not_synced' => [
        'ldap_attr' => '[userPassword]',
        'user_attr' => '',
        'convert' => FALSE,
        'user_tokens' => '',
        'config_module' => 'ldap_user',
        'prov_module' => 'ldap_user',
        'prov_events' => [
          self::EVENT_CREATE_LDAP_ENTRY,
          self::EVENT_SYNC_TO_LDAP_ENTRY,
        ],
      ],
    ],
  ];
}