From 00c5aa9ad4828fd3d18abfa16a9912aa6b53449f Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Wed, 9 Sep 2009 11:10:44 +0200 Subject: [PATCH] Rename ListTest to StorageTest. CS. --- framework/Kolab_Storage/package.xml | 4 +- .../Storage/{ListTest.php => StorageTest.php} | 144 +++++++++++++-------- 2 files changed, 94 insertions(+), 54 deletions(-) rename framework/Kolab_Storage/test/Horde/Kolab/Storage/{ListTest.php => StorageTest.php} (67%) diff --git a/framework/Kolab_Storage/package.xml b/framework/Kolab_Storage/package.xml index 99bd63756..fa38d4d17 100644 --- a/framework/Kolab_Storage/package.xml +++ b/framework/Kolab_Storage/package.xml @@ -99,7 +99,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> - + @@ -197,7 +197,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> - + diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/ListTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/StorageTest.php similarity index 67% rename from framework/Kolab_Storage/test/Horde/Kolab/Storage/ListTest.php rename to framework/Kolab_Storage/test/Horde/Kolab/Storage/StorageTest.php index ada5635e7..f40941963 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/ListTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/StorageTest.php @@ -1,10 +1,15 @@ + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Kolab_Storage */ /** @@ -13,43 +18,47 @@ require_once 'Horde/Autoloader.php'; /** - * Test the Kolab list handler. - * - * $Horde: framework/Kolab_Storage/test/Horde/Kolab/Storage/ListTest.php,v 1.7 2009/01/06 17:49:28 jan Exp $ + * Test the Kolab storage handler. * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * - * @author Gunnar Wrobel - * @package Kolab_Storage + * @category Kolab + * @package Kolab_Storage + * @subpackage UnitTests + * @author Gunnar Wrobel + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Kolab_Storage */ -class Horde_Kolab_Storage_ListTest extends Horde_Kolab_Test_Storage +class Horde_Kolab_Storage_StorageTest extends Horde_Kolab_Test_Storage { /** * Test setup. + * + * @return NULL */ public function setUp() { $world = $this->prepareBasicSetup(); /** Prepare a Kolab test storage */ - $params = array('driver' => 'Mock', - 'username' => 'wrobel@example.org', - 'password' => 'none'); + $params = array('driver' => 'Mock', + 'username' => 'wrobel@example.org', + 'password' => 'none'); $storage1 = Horde_Kolab_Storage::singleton('imap', $params); $folder = $this->prepareNewFolder($storage1, 'Contacts', 'contact', true); - $perms = $folder->getPermission(); - $perms->addUserPermission('test@example.org', PERMS_SHOW); - $perms->save(); + $perms = $folder->getPermission(); + $perms->addUserPermission('test@example.org', PERMS_SHOW); + $perms->save(); $folder = $this->prepareNewFolder($storage1, 'Calendar', 'event', true); - $perms = $folder->getPermission(); - $perms->addUserPermission('test@example.org', PERMS_SHOW); - $perms->save(); + $perms = $folder->getPermission(); + $perms->addUserPermission('test@example.org', PERMS_SHOW); + $perms->save(); /** Prepare a Kolab test storage */ $storage2 = $this->authenticate($world['auth'], @@ -61,41 +70,49 @@ class Horde_Kolab_Storage_ListTest extends Horde_Kolab_Test_Storage $this->prepareNewFolder($storage2, 'Calendar', 'event', true); $this->prepareNewFolder($storage2, 'TestCalendar', 'event'); - $this->list = &$storage2; + $this->storage = &$storage2; } /** * Test destruction. + * + * @return NULL */ public function tearDown() { Horde_Imap_Client_Mock::clean(); - $this->list->clean(); + $this->storage->clean(); } /** * Test class construction. + * + * @return NULL */ public function testConstruct() { - $this->assertTrue($this->list instanceOf Horde_Kolab_Storage); + $this->assertTrue($this->storage instanceOf Horde_Kolab_Storage); } /** * Test listing folders. + * + * @return NULL */ public function testListFolders() { - $folders = $this->list->listFolders(); + $folders = $this->storage->listFolders(); $this->assertContains('INBOX/Contacts', $folders); } /** * Test folder retrieval. + * + * @return NULL */ public function testGetFolders() { - $folders = $this->list->getFolders(); + $folders = $this->storage->getFolders(); $this->assertEquals(6, count($folders)); $folder_names = array(); foreach ($folders as $folder) { @@ -106,19 +123,23 @@ class Horde_Kolab_Storage_ListTest extends Horde_Kolab_Test_Storage /** * Test retrieving by share ID. + * + * @return NULL */ public function testGetByShare() { - $folder = $this->list->getByShare('test@example.org', 'event'); + $folder = $this->storage->getByShare('test@example.org', 'event'); $this->assertEquals('INBOX/Calendar', $folder->name); } /** * Test fetching the folder type. + * + * @return NULL */ public function testGetByType() { - $folders = $this->list->getByType('event'); + $folders = $this->storage->getByType('event'); $this->assertEquals(3, count($folders)); $names = array(); foreach ($folders as $folder) { @@ -130,57 +151,67 @@ class Horde_Kolab_Storage_ListTest extends Horde_Kolab_Test_Storage /** * Test retrieving the default folder. + * + * @return NULL */ public function testGetDefault() { - $folder = $this->list->getDefault('event'); + $folder = $this->storage->getDefault('event'); $this->assertEquals('INBOX/Calendar', $folder->name); - $folder = $this->list->getDefault('contact'); + $folder = $this->storage->getDefault('contact'); $this->assertEquals('INBOX/Contacts', $folder->name); } /** * Test foreign folder owner. + * + * @return NULL */ public function testGetForeignOwner() { - $folder = $this->list->getFolder('user/wrobel'); + $folder = $this->storage->getFolder('user/wrobel'); $this->assertEquals('wrobel@example.org', $folder->getOwner()); } /** * Test retrieving a foreign default folder. + * + * @return NULL */ public function testGetForeignDefault() { - $folder = $this->list->getForeignDefault('wrobel@example.org', 'event'); + $folder = $this->storage->getForeignDefault('wrobel@example.org', 'event'); $this->assertEquals('user/wrobel/Calendar', $folder->name); $this->assertEquals('user%2Fwrobel%2FCalendar', $folder->getShareId()); - $folder = $this->list->getForeignDefault('wrobel@example.org', 'contact'); + $folder = $this->storage->getForeignDefault('wrobel@example.org', 'contact'); $this->assertEquals('user/wrobel/Contacts', $folder->name); $this->assertEquals('user%2Fwrobel%2FContacts', $folder->getShareId()); } /** * Test folder creation. + * + * @return NULL */ public function testCreate() { - $folder = $this->list->getNewFolder(); + $folder = $this->storage->getNewFolder(); $folder->setName('Notes'); $folder->save(array()); - $result = $this->list->getFolder('INBOX/Notes'); + $result = $this->storage->getFolder('INBOX/Notes'); $this->assertTrue($result instanceOf Horde_Kolab_Storage_Folder); } /** * Test cache update. + * + * @return NULL */ public function testCacheAdd() { - $params = array('driver' => 'Mock', - 'username' => 'cacheadd@example.org', - 'password' => 'none'); + $params = array('driver' => 'Mock', + 'username' => 'cacheadd@example.org', + 'password' => 'none'); $storage4 = $this->getMock('Horde_Kolab_Storage', array('addToCache', 'removeFromCache'), array('imap', $params)); @@ -194,12 +225,14 @@ class Horde_Kolab_Storage_ListTest extends Horde_Kolab_Test_Storage /** * Test cache update. + * + * @return NULL */ public function testCacheDelete() { - $params = array('driver' => 'Mock', - 'username' => 'cachedel@example.org', - 'password' => 'none'); + $params = array('driver' => 'Mock', + 'username' => 'cachedel@example.org', + 'password' => 'none'); $storage4 = $this->getMock('Horde_Kolab_Storage', array('addToCache', 'removeFromCache'), array('imap', $params)); @@ -215,58 +248,65 @@ class Horde_Kolab_Storage_ListTest extends Horde_Kolab_Test_Storage /** * Test renaming folders. + * + * @return NULL */ public function testRename() { - $folder = &$this->list->getFolder('INBOX/TestContacts'); + $folder = &$this->storage->getFolder('INBOX/TestContacts'); $folder->setName('TestNotes'); $folder->save(array()); - $this->assertNotContains('INBOX/TestContacts', $this->list->listFolders()); - $this->assertContains('INBOX/TestNotes', $this->list->listFolders()); + $this->assertNotContains('INBOX/TestContacts', + $this->storage->listFolders()); + $this->assertContains('INBOX/TestNotes', $this->storage->listFolders()); } /** * Test folder removal. + * + * @return NULL */ public function testRemove() { - $folder = &$this->list->getFolder('INBOX/Calendar'); + $folder = &$this->storage->getFolder('INBOX/Calendar'); $this->assertTrue($folder->exists()); $this->assertTrue($folder->isDefault()); $folder->delete(); - $this->assertNotContains('INBOX/Calendar', $this->list->listFolders()); + $this->assertNotContains('INBOX/Calendar', $this->storage->listFolders()); } /** * Test the list cache. + * + * @return NULL */ public function testCaching() { - $params = array('driver' => 'Mock', - 'username' => 'cache@example.org', - 'password' => 'none'); + $params = array('driver' => 'Mock', + 'username' => 'cache@example.org', + 'password' => 'none'); $storage3 = Horde_Kolab_Storage::singleton('imap', $params); - $folders = $storage3->getFolders(); + $folders = $storage3->getFolders(); $this->assertTrue(count($folders) == 1); $folders = $storage3->getByType('event'); $this->assertTrue(empty($folders)); $default = $storage3->getDefault('event'); $this->assertTrue(empty($default)); $connection = $storage3->getConnection(); - $addfolder = new Horde_Kolab_Storage_Folder(null); + $addfolder = new Horde_Kolab_Storage_Folder(null); $addfolder->restore($storage3, $connection->connection); $addfolder->setName('TestFolder'); $addfolder->save(array('type' => 'event', 'default' => true)); $this->assertContains('INBOX/TestFolder', $storage3->listFolders()); $this->assertEquals('test@example.org', $addfolder->getOwner()); $folders = $storage3->getFolders(); - $names = array(); + $names = array(); foreach ($folders as $folder) { $names[] = $folder->name; } $this->assertContains('INBOX/TestFolder', $names); $folders = $storage3->getByType('event'); - $names = array(); + $names = array(); foreach ($folders as $folder) { $names[] = $folder->name; } @@ -277,13 +317,13 @@ class Horde_Kolab_Storage_ListTest extends Horde_Kolab_Test_Storage $addfolder->setName('NewCal'); $addfolder->save(); $folders = $storage3->getFolders(); - $names = array(); + $names = array(); foreach ($folders as $folder) { $names[] = $folder->name; } $this->assertContains('INBOX/NewCal', $names); $folders = $storage3->getByType('event'); - $names = array(); + $names = array(); foreach ($folders as $folder) { $names[] = $folder->name; } -- 2.11.0