1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
<?php
require_once dirname(__FILE__) . '/TestBase.php';
/**
* Test cases for the Turba_Driver:: class
*
* $Horde: turba/lib/tests/DriverTest.php,v 1.2.2.1 2007/12/20 14:34:31 jan Exp $
*
* @author Jason M. Felice <jason.m.felice@gmail.com>
* @package Turba
* @subpackage UnitTests
*/
class Turba_DriverTest extends Turba_TestBase {
function setUp()
{
parent::setUp();
$this->setUpDatabase();
}
function test_search_results_should_be_sorted_according_to_supplied_sort_order()
{
$this->assertSortsList(array($this, 'doSearch'));
}
/**
* This is how we are called from the addField API
*/
function test_search_with_null_order_parameter_works()
{
$driver = $this->getDriver();
$this->fakeAuth();
$list = $driver->search(array(), null, 'AND');
$this->assertOk($list);
if (!$this->assertTrue(is_a($list, 'Turba_List'))) {
return;
}
$this->assertOk($list->reset());
$this->assertTrue($list->next());
$this->assertTrue($list->next());
}
function doSearch($order)
{
$driver = $this->getDriver();
$this->fakeAuth();
return $driver->search(array('__type' => 'Object'), $order, 'AND');
}
}
|