You are here

public function SimpleLdapServerTest::testSearch in Simple LDAP 8

@covers ::search @depends testBind @dataProvider searchDataProvider

File

tests/src/Unit/SimpleLdapServerTest.php, line 115
Contains \Drupal\Tests\simple_ldap\Unit\SimpleLdapServer

Class

SimpleLdapServerTest
@coversDefaultClass \Drupal\simple_ldap\SimpleLdapServer @group simple_ldap

Namespace

Drupal\Tests\simple_ldap\Unit

Code

public function testSearch($test_results, $scope, $method) {
  $this
    ->setUpSearchTestMocks($test_results);
  $this->ldap
    ->expects($this
    ->once())
    ->method($method)
    ->willReturn('12345678');

  // Arbitrary value to simulate an LDAP search identifier resource.
  $server = new SimpleLdapServer($this->config_factory, $this->ldap);
  $server
    ->connect();
  $server
    ->bind();
  $results = $server
    ->search('dc=local', 'cn=ldapuser', $scope);
  $this
    ->assertArrayEquals($test_results, $results);
}