You are here

public function SimpleLdapServerTest::testSetPageSize in Simple LDAP 8

@covers ::getPageSize @covers ::setRootDse @depends testSearch

File

tests/src/Unit/SimpleLdapServerTest.php, line 173
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 testSetPageSize() {
  $test_results = array(
    '' => array(
      'supportedcontrol' => array(
        '1.2.840.113556.1.4.319',
        'returned_value_2',
      ),
    ),
    'count' => 1,
    0 => 'test_result',
  );
  $this->config
    ->expects($this
    ->once())
    ->method('get')
    ->with('pagesize')
    ->willReturn(10);
  $this
    ->setUpSearchTestMocks($test_results);
  $this->ldap
    ->expects($this
    ->once())
    ->method('ldapRead')
    ->willReturn('12345678');

  // Arbitrary value to simulate an LDAP search identifier resource.
  $this->ldap
    ->expects($this
    ->once())
    ->method('controlPageResultResponse')
    ->with('12345678', '');
  $server = new SimpleLdapServer($this->config_factory, $this->ldap);
  $server
    ->connect();
  $server
    ->bind();
  $result = $server
    ->getPageSize();
  $this
    ->assertEquals(10, $result);
}