1<?php 2/** 3 * Test the LDAP result handler. 4 * 5 * PHP version 5 6 * 7 * @category Kolab 8 * @package Kolab_Server 9 * @author Gunnar Wrobel <wrobel@pardus.de> 10 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 11 * @link http://pear.horde.org/index.php?package=Kolab_Server 12 */ 13 14/** 15 * Require our basic test case definition 16 */ 17require_once __DIR__ . '/../../../LdapTestCase.php'; 18 19/** 20 * Test the LDAP result handler. 21 * 22 * Copyright 2009-2016 Horde LLC (http://www.horde.org/) 23 * 24 * See the enclosed file COPYING for license information (LGPL). If you 25 * did not receive this file, see http://www.horde.org/licenses/lgpl21. 26 * 27 * @category Kolab 28 * @package Kolab_Server 29 * @author Gunnar Wrobel <wrobel@pardus.de> 30 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 31 * @link http://pear.horde.org/index.php?package=Kolab_Server 32 */ 33class Horde_Kolab_Server_Class_Server_Result_LdapTest extends Horde_Kolab_Server_LdapTestCase 34{ 35 public function setUp() 36 { 37 $this->skipIfNoLdap(); 38 } 39 40 public function testMethodConstructHasParameterNetldap2searchSearchResult() 41 { 42 $search = $this->getMock( 43 'Horde_Ldap_Search', array(), array(), '', false 44 ); 45 $result = new Horde_Kolab_Server_Result_Ldap($search); 46 } 47 48 49 public function testMethodCountHasResultIntTheNumberOfElementsFound() 50 { 51 $search = $this->getMock( 52 'Horde_Ldap_Search', array('count'), array(), '', false 53 ); 54 $search->expects($this->exactly(1)) 55 ->method('count') 56 ->will($this->returnValue(1)); 57 $result = new Horde_Kolab_Server_Result_Ldap($search); 58 $this->assertEquals(1, $result->count()); 59 } 60 61 public function testMethodSizelimitexceededHasResultBooleanIndicatingIfTheSearchSizeLimitWasHit() 62 { 63 $search = $this->getMock( 64 'Horde_Ldap_Search', array('sizeLimitExceeded'), array(), '', false 65 ); 66 $search->expects($this->exactly(1)) 67 ->method('sizeLimitExceeded') 68 ->will($this->returnValue(true)); 69 $result = new Horde_Kolab_Server_Result_Ldap($search); 70 $this->assertTrue($result->sizeLimitExceeded()); 71 } 72 73 public function testMethodAsarrayHasResultArrayWithTheSearchResults() 74 { 75 $search = $this->getMock( 76 'Horde_Ldap_Search', array('asArray'), array(), '', false 77 ); 78 $search->expects($this->exactly(1)) 79 ->method('asArray') 80 ->will($this->returnValue(array('a' => 'a'))); 81 $result = new Horde_Kolab_Server_Result_Ldap($search); 82 $this->assertEquals(array('a' => 'a'), $result->asArray()); 83 } 84} 85