1<?php 2/** 3 * Test the search operations restricted to groups. 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__ . '/../../../../TestCase.php'; 18 19/** 20 * Test the search operations restricted to groups. 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_Search_Operation_RestrictgroupsTest 34extends Horde_Kolab_Server_TestCase 35{ 36 public function setUp() 37 { 38 $this->structure = $this->getMock('Horde_Kolab_Server_Structure_Interface'); 39 } 40 41 public function testMethodSearchrestrictgroupsHasResultRestrictedToGroups() 42 { 43 $result = $this->getMock('Horde_Kolab_Server_Result_Interface'); 44 $result->expects($this->once()) 45 ->method('asArray') 46 ->will($this->returnValue(array('a' => 'a'))); 47 $this->structure->expects($this->once()) 48 ->method('find') 49 ->with( 50 $this->isRestrictedToGroups(), 51 array('attributes' => 'guid') 52 ) 53 ->will($this->returnValue($result)); 54 $search = new Horde_Kolab_Server_Search_Operation_Restrictgroups($this->structure); 55 $criteria = $this->getMock('Horde_Kolab_Server_Query_Element_Interface'); 56 $this->assertEquals(array('a'), $search->searchRestrictGroups($criteria)); 57 } 58}