You are here

protected function SimpleLdapServerTest::setUpSearchTestMocks in Simple LDAP 8

Most of the Search tests expect the same things.

Parameters

$result_array:

4 calls to SimpleLdapServerTest::setUpSearchTestMocks()
SimpleLdapServerTest::testGetServerType in tests/src/Unit/SimpleLdapServerTest.php
@dataProvider serverTypeDataProvider
SimpleLdapServerTest::testSearch in tests/src/Unit/SimpleLdapServerTest.php
@covers ::search @depends testBind @dataProvider searchDataProvider
SimpleLdapServerTest::testSetPageSize in tests/src/Unit/SimpleLdapServerTest.php
@covers ::getPageSize @covers ::setRootDse @depends testSearch
SimpleLdapServerTest::testSetPageSizeUnavailable in tests/src/Unit/SimpleLdapServerTest.php
@covers ::getPageSize @covers ::setRootDse @depends testSearch

File

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

Class

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

Namespace

Drupal\Tests\simple_ldap\Unit

Code

protected function setUpSearchTestMocks($result_array) {
  $this->ldap
    ->expects($this
    ->any())
    ->method('isBound')
    ->willReturn(TRUE);
  $this->ldap
    ->expects($this
    ->once())
    ->method('getEntries')
    ->willReturn($result_array);
  $this->ldap
    ->expects($this
    ->once())
    ->method('freeResult')
    ->willReturn(TRUE);
  $this->ldap
    ->expects($this
    ->once())
    ->method('clean')
    ->willReturn($result_array);
}