* @license http://www.fsf.org/copyleft/lgpl.html LGPL
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
-class Horde_Kolab_Storage_AttachmentTest extends Horde_Kolab_Storage_Scenario
+class Horde_Kolab_Storage_AttachmentTest extends PHPUnit_Framework_TestCase
{
/**
* Test setup.
* PHP version 5
*
* @category Kolab
- * @package Kolab_Server
+ * @package Kolab_Session
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Kolab_Server
+ * @link http://pear.horde.org/index.php?package=Kolab_Session
*/
-/**
- * The Autoloader allows us to omit "require/include" statements.
- */
-require_once 'Horde/Autoloader.php';
-
-if (!defined('HORE_KOLAB_SERVER_TESTS')) {
- $test_dir = '@test_dir@/Kolab_Server';
-
- if (substr($test_dir, 0, 1) == '@') {
- /**
- * Assume we are working in development mode and this package resides in
- * 'framework'.
- */
- define('HORE_KOLAB_SERVER_TESTS', dirname(__FILE__) . '/../../../../../Kolab_Server/test');
- } else {
- define('HORE_KOLAB_SERVER_TESTS', $test_dir);
- }
-
- Horde_Autoloader::addClassPath(HORE_KOLAB_SERVER_TESTS);
-}
-
-if (!defined('HORE_KOLAB_STORAGE_TESTS')) {
- $test_dir = '@test_dir@/Kolab_Storage';
-
- if (substr($test_dir, 0, 1) == '@') {
- /**
- * Assume we are working in development mode and this package resides in
- * 'framework'.
- */
- define('HORE_KOLAB_STORAGE_TESTS', dirname(__FILE__) . '/../../..');
- } else {
- define('HORE_KOLAB_STORAGE_TESTS', $test_dir);
- }
-
- Horde_Autoloader::addClassPath(HORE_KOLAB_STORAGE_TESTS);
+if (!spl_autoload_functions()) {
+ spl_autoload_register(
+ create_function(
+ '$class',
+ '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class);'
+ . '$err_mask = E_ALL ^ E_WARNING;'
+ . '$oldErrorReporting = error_reporting($err_mask);'
+ . 'include "$filename.php";'
+ . 'error_reporting($oldErrorReporting);'
+ )
+ );
}
-require_once 'Horde/Group.php';
+/** Catch strict standards */
+error_reporting(E_ALL | E_STRICT);
*/
class Horde_Kolab_Storage_CacheTest extends PHPUnit_Framework_TestCase
{
+ public function setUp()
+ {
+ $this->cache = new Horde_Cache_Mock();
+ }
+
/**
* Test cleaning the cache.
*
*/
public function testReset()
{
- $cache = new Horde_Kolab_Storage_Cache();
+ $cache = new Horde_Kolab_Storage_Cache($this->cache);
$cache->reset();
$this->assertEquals(-1, $cache->validity);
$this->assertEquals(-1, $cache->nextid);
*/
public function testStore()
{
- $cache = new Horde_Kolab_Storage_Cache();
+ $cache = new Horde_Kolab_Storage_Cache($this->cache);
$cache->reset();
$item = array(1);
$cache->store(10, 1, $item);
*/
public function testIgnore()
{
- $cache = new Horde_Kolab_Storage_Cache();
+ $cache = new Horde_Kolab_Storage_Cache($this->cache);
$cache->reset();
$cache->ignore(11);
$this->assertEquals(false, $cache->uids[11]);
*/
public function testAttachments()
{
- $cache = new Horde_Kolab_Storage_Cache();
+ $cache = new Horde_Kolab_Storage_Cache($this->cache);
$cache->storeAttachment('a', 'attachment');
$this->assertEquals('attachment', $cache->loadAttachment('a'));
$cache->storeAttachment('b', 'b');
}
/**
- * Test configration.
- *
- * @return NULL
- */
- public function testConfigruation()
- {
- $cache = new Horde_Kolab_Storage_Cache();
-
- $GLOBALS['conf']['kolab']['storage']['cache']['data']['driver'] = 'file';
-
- $cache2 = new Horde_Kolab_Storage_Cache();
-
- $GLOBALS['conf']['kolab']['storage']['cache']['data']['params'] = array('prefix' => 'kolab_cache',
- 'dir' => Horde::getTempDir());
-
- $cache3 = new Horde_Kolab_Storage_Cache();
- }
- /**
- * Test creating the cache singleton.
- *
- * @return NULL
- */
- public function testSingleton()
- {
- $cache = Horde_Kolab_Storage_Cache::singleton();
- $cache2 = new Horde_Kolab_Storage_Cache();
- $this->assertTrue($cache !== $cache2);
- $cache3 = Horde_Kolab_Storage_Cache::singleton();
- $this->assertTrue($cache === $cache3);
- }
-
- /**
* Test loading/saving the cache.
*
* @return NULL
*/
public function testLoadSave()
{
- $cache = new Horde_Kolab_Storage_Cache();
+ $cache = new Horde_Kolab_Storage_Cache($this->cache);
$cache->load('test', 1);
/**
* Loading a second time should return immediately (see code
* @license http://www.fsf.org/copyleft/lgpl.html LGPL
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
-class Horde_Kolab_Storage_DataTest extends Horde_Kolab_Storage_Scenario
+class Horde_Kolab_Storage_DataTest extends PHPUnit_Framework_TestCase
{
/**
* Test setup.
*/
public function setUp()
{
- // No 'auth' in world, so this won't work yet. Skip it.
- $this->markTestSkipped();
-
- $world = $this->prepareBasicSetup();
-
- $this->storage = $this->authenticate($world['auth'],
- 'wrobel@example.org',
- 'none');
-
- $this->folder = $this->prepareNewFolder($this->storage, 'Contacts', 'contact', true);
- $this->prepareNewFolder($this->storage, 'NewContacts', 'contact');
}
/**
*/
public function tearDown()
{
- Horde_Imap_Client_Mock::clean();
- if ($this->storage) {
- $this->storage->clean();
- }
}
/**
{
$data = new Horde_Kolab_Storage_Data('test');
- $folder = new Horde_Kolab_Storage_Folder('INBOX/Test');
+ $folder = new Horde_Kolab_Storage_Folder_Base('INBOX/Test');
$data->setFolder($folder);
$this->assertEquals('user/wrobel/Test', $data->getCacheKey());
}
*/
public function testDelete()
{
+ $this->markTestIncomplete();
+
$data = new Horde_Kolab_Storage_Data('contact');
$data->setFolder($this->folder);
*/
public function testMove()
{
+ $this->markTestIncomplete();
+
$data = new Horde_Kolab_Storage_Data('contact');
$folder = $this->storage->getFolder('INBOX/Contacts');
$data->setFolder($folder);
*/
public function testSave()
{
- $data = new Horde_Kolab_Storage_Data('contact');
- $data->setFolder($this->folder);
- /**
- * During testing we want to ensure that we do not access any
- * old, cached data. The cache gets loaded when calling
- * getObjectIds and is manually expired afterwards.
- */
- $result = $data->getObjectIds();
- $data->expireCache();
- $object = array(
- 'uid' => '1',
- 'given-name' => 'Gunnar',
- 'full-name' => 'Gunnar Wrobel',
- 'email' => 'p@rdus.de'
- );
+ require_once 'Horde/Group.php';
+ require_once 'Horde/Group/mock.php';
+
+ $group = new Group_mock();
+ $driver = new Horde_Kolab_Storage_Driver_Mock($group);
+ $cache = new Horde_Cache_Mock();
+ $storage = new Horde_Kolab_Storage($driver, $cache);
+ $data = $storage->getFolderData('INBOX/Contacs');
try {
$result = $data->save($object, '1000');
*/
public function testObjectDeleteAll()
{
+ $this->markTestIncomplete();
+
$data = new Horde_Kolab_Storage_Data('contact');
$data->setFolder($this->folder);
/**
* @license http://www.fsf.org/copyleft/lgpl.html LGPL
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
-class Horde_Kolab_Storage_FolderTest extends Horde_Kolab_Storage_Scenario
+class Horde_Kolab_Storage_FolderTest extends PHPUnit_Framework_TestCase
{
/**
* Test setup.
* @license http://www.fsf.org/copyleft/lgpl.html LGPL
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
-class Horde_Kolab_Storage_StorageTest extends Horde_Kolab_Storage_Scenario
+class Horde_Kolab_Storage_StorageTest extends PHPUnit_Framework_TestCase
{
/**
* Test setup.
--- /dev/null
+<?php
+/**
+ * Test the triggering mechanism.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once 'Autoload.php';
+
+/**
+ * Test the triggering mechanism.
+ *
+ * Copyright 2010 Klarälvdalens Datakonsult AB
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package Kolab_Storage
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Kolab_Storage
+ */
+class Horde_Kolab_Storage_TriggerTest extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $this->_storage = $this->getMock('Horde_Kolab_Storage', array(), array(), '', false, false);
+ $this->_connection = $this->getMock('Horde_Kolab_Storage_Driver');
+ }
+
+}
\ No newline at end of file