Reorganize test suite.
authorGunnar Wrobel <p@rdus.de>
Wed, 2 Dec 2009 21:14:34 +0000 (22:14 +0100)
committerGunnar Wrobel <wrobel@temple.(none)>
Wed, 23 Jun 2010 17:29:52 +0000 (19:29 +0200)
33 files changed:
framework/Kolab_Format/test/Horde/Kolab/Format/AllTests.php
framework/Kolab_Format/test/Horde/Kolab/Format/Autoload.php [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/ContactTest.php [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/EventTest.php [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_category.xml [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_mail.xml [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_pgp.xml [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/event_umlaut.xml [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/event_umlaut_broken.xml [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/preferences_read_old.xml [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/preferences_write_old.xml [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/recur.xml [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/recur_fail.xml [new file with mode: 0644]
framework/Kolab_Format/test/Horde/Kolab/Format/MimeAttrTest.php [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/PreferencesTest.php [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/RecurrenceTest.php [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/XmlTest.php [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_category.xml [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_mail.xml [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_pgp.xml [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/event_umlaut.xml [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/event_umlaut_broken.xml [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/preferences_read_old.xml [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/preferences_write_old.xml [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/recur.xml [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/recur_fail.xml [deleted file]
framework/Kolab_Format/test/Horde/Kolab/Format/phpunit.xml [new file with mode: 0644]

index 8dba17f..571fdaf 100644 (file)
@@ -4,11 +4,12 @@
  *
  * PHP version 5
  *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
  */
 
 /**
@@ -21,11 +22,22 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
 /**
  * Prepare the test setup.
  */
-require_once 'Horde/Test/AllTests.php';
+require_once dirname(__FILE__) . '/Autoload.php';
 
 /**
- * @package    Horde_Kolab_Format
+ * Combine the tests for this package.
+ *
+ * Copyright 2007-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.
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
  * @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_Format
  */
 class Horde_Kolab_Format_AllTests extends Horde_Test_AllTests
 {
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Autoload.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Autoload.php
new file mode 100644 (file)
index 0000000..08ec31f
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Setup autoloading for the tests.
+ *
+ * PHP version 5
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+
+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);'
+        )
+    );
+}
+
+/** Catch strict standards */
+error_reporting(E_ALL | E_STRICT);
+
+/** Load the basic test definition */
+//require_once dirname(__FILE__) . '/TestCase.php';
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/ContactTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/ContactTest.php
deleted file mode 100644 (file)
index cbff2f2..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-<?php
-/**
- * Test the contact XML format.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-
-/**
- * The Autoloader allows us to omit "require/include" statements.
- */
-require_once 'Horde/Autoloader.php';
-
-/**
- * Test the contact XML format.
- *
- * Copyright 2007-2010 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.
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-class Horde_Kolab_Format_ContactTest extends PHPUnit_Framework_TestCase
-{
-
-    /**
-     * Set up testing.
-     *
-     * @return NULL
-     */
-    protected function setUp()
-    {
-        Horde_Nls::setCharset('utf-8');
-    }
-
-    /**
-     * Test storing single mail addresses.
-     *
-     * @return NULL
-     */
-    public function testSingleEmail()
-    {
-        $contact = new Horde_Kolab_Format_Xml_contact_Dummy();
-        $object  = array('uid' => '1',
-                         'full-name' => 'User Name',
-                         'email' => 'user@example.org');
-        $xml     = $contact->save($object);
-        $expect  = file_get_contents(dirname(__FILE__)
-                                     . '/fixtures/contact_mail.xml');
-        $this->assertEquals($expect, $xml);
-    }
-
-    /**
-     * Test storing PGP public keys.
-     *
-     * @return NULL
-     */
-    public function testPGP()
-    {
-        $contact = new Horde_Kolab_Format_Xml_contact_Dummy();
-        $object  = array('uid' => '1',
-                         'full-name' => 'User Name',
-                         'pgp-publickey' => 'PGP Test Key',
-                         'email' => 'user@example.org');
-        $xml     = $contact->save($object);
-        $expect  = file_get_contents(dirname(__FILE__)
-                                     . '/fixtures/contact_pgp.xml');
-        $this->assertEquals($expect, $xml);
-    }
-
-    /**
-     * Test loading a contact with a category.
-     *
-     * @return NULL
-     */
-    public function testCategories()
-    {
-        global $prefs;
-
-        $contact = new Horde_Kolab_Format_Xml_contact();
-        $xml     = file_get_contents(dirname(__FILE__)
-                                     . '/fixtures/contact_category.xml');
-        $object  = $contact->load($xml);
-        $this->assertContains('Test', $object['categories']);
-
-        $prefs  = 'some string';
-        $object = $contact->load($xml);
-        $this->assertContains('Test', $object['categories']);
-    }
-
-    /**
-     * Test loading a contact with a category with preferences.
-     *
-     * @return NULL
-     */
-    public function testCategoriesWithPrefs()
-    {
-        if (class_exists('Horde_Prefs')) {
-            /* Monkey patch to allw the value to be set. */
-            $prefs->_prefs['categories'] = array('v' => '');
-
-            $contact = new Horde_Kolab_Format_Xml_contact();
-            $xml     = file_get_contents(dirname(__FILE__)
-                                         . '/fixtures/contact_category.xml');
-            $object  = $contact->load($xml);
-            $this->assertContains('Test', $object['categories']);
-        }
-    }
-
-
-}
-
-/**
- * A dummy registry.
- *
- * Copyright 2007-2010 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.
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-class DummyRegistry
-{
-    /**
-     * Returns the application context.
-     *
-     * @return string Always "horde".
-     */
-    function get()
-    {
-        return 'horde';
-    }
-}
-
-/**
- * A modification to the original contact handler. This prevents unpredictable
- * date entries.
- *
- * Copyright 2007-2010 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.
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-class Horde_Kolab_Format_Xml_Contact_Dummy extends Horde_Kolab_Format_Xml_Contact
-{
-    /**
-     * Save the object creation date.
-     *
-     * @param DOMNode $parent_node The parent node to attach the child
-     *                             to.
-     * @param string  $name        The name of the node.
-     * @param mixed   $value       The value to store.
-     * @param boolean $missing     Has the value been missing?
-     *
-     * @return DOMNode The new child node.
-     */
-    function _saveCreationDate($parent_node, $name, $value, $missing)
-    {
-        // Only create the creation date if it has not been set before
-        if ($missing) {
-            $value = 0;
-        }
-        return $this->_saveDefault($parent_node,
-                                   $name,
-                                   $value,
-                                   array('type' => self::TYPE_DATETIME));
-    }
-
-    /**
-     * Save the object modification date.
-     *
-     * @param DOMNode $parent_node The parent node to attach
-     *                             the child to.
-     * @param string  $name        The name of the node.
-     * @param mixed   $value       The value to store.
-     * @param boolean $missing     Has the value been missing?
-     *
-     * @return DOMNode The new child node.
-     */
-    function _saveModificationDate($parent_node, $name, $value, $missing)
-    {
-        // Always store now as modification date
-        return $this->_saveDefault($parent_node,
-                                   $name,
-                                   0,
-                                   array('type' => self::TYPE_DATETIME));
-    }
-}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/EventTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/EventTest.php
deleted file mode 100644 (file)
index 7d8a1da..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-/**
- * Test event handling within the Kolab format implementation.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-
-/**
- * The Autoloader allows us to omit "require/include" statements.
- */
-require_once 'Horde/Autoloader.php';
-
-/**
- * Test event handling.
- *
- * Copyright 2007-2010 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.
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-class Horde_Kolab_Format_EventTest extends PHPUnit_Framework_TestCase
-{
-
-    /**
-     * Set up testing.
-     *
-     * @return NULL
-     */
-    protected function setUp()
-    {
-        Horde_Nls::setCharset('utf-8');
-        Horde_String::setDefaultCharset('iso-8859-1');
-    }
-
-
-    /**
-     * Test for https://www.intevation.de/roundup/kolab/issue3525
-     *
-     * @return NULL
-     */
-    public function testIssue3525()
-    {
-        $xml = Horde_Kolab_Format::factory('XML', 'event');
-
-        // Load XML
-        $event  = file_get_contents(dirname(__FILE__)
-                                    . '/fixtures/event_umlaut.xml');
-        $result = $xml->load($event);
-
-        // Check that the xml loads fine
-        $this->assertEquals(mb_convert_encoding($result['body'], 'UTF-8',
-                                                'ISO-8859-1'), '...übbe...');
-
-        // Load XML
-        $event  = file_get_contents(dirname(__FILE__)
-                                    . '/fixtures/event_umlaut_broken.xml');
-        $result = $xml->load($event);
-
-        /**
-         * FIXME: Why does Kolab Format return ISO-8859-1? UTF-8 would seem more
-         * appropriate
-         */
-        $this->assertEquals(mb_convert_encoding($result['body'], 'UTF-8',
-                                                'ISO-8859-1'), '...übbe...');
-    }
-}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php
new file mode 100644 (file)
index 0000000..e39fc8d
--- /dev/null
@@ -0,0 +1,211 @@
+<?php
+/**
+ * Test the contact XML format.
+ *
+ * PHP version 5
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../Autoload.php';
+
+/**
+ * Test the contact XML format.
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+class Horde_Kolab_Format_Integration_ContactTest
+extends PHPUnit_Framework_TestCase
+{
+    /**
+     * Set up testing.
+     *
+     * @return NULL
+     */
+    protected function setUp()
+    {
+        Horde_Nls::setCharset('utf-8');
+    }
+
+    /**
+     * Test storing single mail addresses.
+     *
+     * @return NULL
+     */
+    public function testSingleEmail()
+    {
+        $contact = new Horde_Kolab_Format_Xml_contact_Dummy();
+        $object  = array('uid' => '1',
+                         'full-name' => 'User Name',
+                         'email' => 'user@example.org');
+        $xml     = $contact->save($object);
+        $expect  = file_get_contents(dirname(__FILE__)
+                                     . '/fixtures/contact_mail.xml');
+        $this->assertEquals($expect, $xml);
+    }
+
+    /**
+     * Test storing PGP public keys.
+     *
+     * @return NULL
+     */
+    public function testPGP()
+    {
+        $contact = new Horde_Kolab_Format_Xml_contact_Dummy();
+        $object  = array('uid' => '1',
+                         'full-name' => 'User Name',
+                         'pgp-publickey' => 'PGP Test Key',
+                         'email' => 'user@example.org');
+        $xml     = $contact->save($object);
+        $expect  = file_get_contents(dirname(__FILE__)
+                                     . '/fixtures/contact_pgp.xml');
+        $this->assertEquals($expect, $xml);
+    }
+
+    /**
+     * Test loading a contact with a category.
+     *
+     * @return NULL
+     */
+    public function testCategories()
+    {
+        global $prefs;
+
+        $contact = new Horde_Kolab_Format_Xml_contact();
+        $xml     = file_get_contents(dirname(__FILE__)
+                                     . '/fixtures/contact_category.xml');
+        $object  = $contact->load($xml);
+        $this->assertContains('Test', $object['categories']);
+
+        $prefs  = 'some string';
+        $object = $contact->load($xml);
+        $this->assertContains('Test', $object['categories']);
+    }
+
+    /**
+     * Test loading a contact with a category with preferences.
+     *
+     * @return NULL
+     */
+    public function testCategoriesWithPrefs()
+    {
+        if (class_exists('Horde_Prefs')) {
+            /* Monkey patch to allw the value to be set. */
+            $prefs->_prefs['categories'] = array('v' => '');
+
+            $contact = new Horde_Kolab_Format_Xml_contact();
+            $xml     = file_get_contents(dirname(__FILE__)
+                                         . '/fixtures/contact_category.xml');
+            $object  = $contact->load($xml);
+            $this->assertContains('Test', $object['categories']);
+        }
+    }
+
+
+}
+
+/**
+ * A dummy registry.
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category Kolab
+ * @package  Kolab_Format
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Format
+ */
+class DummyRegistry
+{
+    /**
+     * Returns the application context.
+     *
+     * @return string Always "horde".
+     */
+    function get()
+    {
+        return 'horde';
+    }
+}
+
+/**
+ * A modification to the original contact handler. This prevents unpredictable
+ * date entries.
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category Kolab
+ * @package  Kolab_Format
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Format
+ */
+class Horde_Kolab_Format_Xml_Contact_Dummy extends Horde_Kolab_Format_Xml_Contact
+{
+    /**
+     * Save the object creation date.
+     *
+     * @param DOMNode $parent_node The parent node to attach the child
+     *                             to.
+     * @param string  $name        The name of the node.
+     * @param mixed   $value       The value to store.
+     * @param boolean $missing     Has the value been missing?
+     *
+     * @return DOMNode The new child node.
+     */
+    function _saveCreationDate($parent_node, $name, $value, $missing)
+    {
+        // Only create the creation date if it has not been set before
+        if ($missing) {
+            $value = 0;
+        }
+        return $this->_saveDefault($parent_node,
+                                   $name,
+                                   $value,
+                                   array('type' => self::TYPE_DATETIME));
+    }
+
+    /**
+     * Save the object modification date.
+     *
+     * @param DOMNode $parent_node The parent node to attach
+     *                             the child to.
+     * @param string  $name        The name of the node.
+     * @param mixed   $value       The value to store.
+     * @param boolean $missing     Has the value been missing?
+     *
+     * @return DOMNode The new child node.
+     */
+    function _saveModificationDate($parent_node, $name, $value, $missing)
+    {
+        // Always store now as modification date
+        return $this->_saveDefault($parent_node,
+                                   $name,
+                                   0,
+                                   array('type' => self::TYPE_DATETIME));
+    }
+}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php
new file mode 100644 (file)
index 0000000..640f059
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+/**
+ * Test event handling within the Kolab format implementation.
+ *
+ * PHP version 5
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../Autoload.php';
+
+/**
+ * Test event handling.
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+class Horde_Kolab_Format_Integration_EventTest
+extends PHPUnit_Framework_TestCase
+{
+
+    /**
+     * Set up testing.
+     *
+     * @return NULL
+     */
+    protected function setUp()
+    {
+        Horde_Nls::setCharset('utf-8');
+        Horde_String::setDefaultCharset('iso-8859-1');
+    }
+
+
+    /**
+     * Test for https://www.intevation.de/roundup/kolab/issue3525
+     *
+     * @return NULL
+     */
+    public function testIssue3525()
+    {
+        $xml = Horde_Kolab_Format::factory('XML', 'event');
+
+        // Load XML
+        $event  = file_get_contents(dirname(__FILE__)
+                                    . '/fixtures/event_umlaut.xml');
+        $result = $xml->load($event);
+
+        // Check that the xml loads fine
+        $this->assertEquals(mb_convert_encoding($result['body'], 'UTF-8',
+                                                'ISO-8859-1'), '...übbe...');
+
+        // Load XML
+        $event  = file_get_contents(dirname(__FILE__)
+                                    . '/fixtures/event_umlaut_broken.xml');
+        $result = $xml->load($event);
+
+        /**
+         * FIXME: Why does Kolab Format return ISO-8859-1? UTF-8 would seem more
+         * appropriate
+         */
+        $this->assertEquals(mb_convert_encoding($result['body'], 'UTF-8',
+                                                'ISO-8859-1'), '...übbe...');
+    }
+}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php
new file mode 100644 (file)
index 0000000..d936c13
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+/**
+ * Test Kolab Format MIME attributes
+ *
+ * PHP version 5
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../Autoload.php';
+
+/**
+ * Test Kolab Format MIME attributes
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+class Horde_Kolab_Format_Integration_MimeAttrTest
+extends PHPUnit_Framework_TestCase
+{
+    /**
+     * Set up testing.
+     *
+     * @return NULL
+     */
+    protected function setUp()
+    {
+        Horde_Nls::setCharset('utf-8');
+    }
+
+    /**
+     * Test retrieving the document name.
+     *
+     * @return NULL
+     */
+    public function testGetName()
+    {
+        $format = Horde_Kolab_Format::factory('XML', 'contact');
+        $this->assertEquals('kolab.xml', $format->getName());
+    }
+
+    /**
+     * Test retrieving the document mime type.
+     *
+     * @return NULL
+     */
+    public function testMimeType()
+    {
+        $format = Horde_Kolab_Format::factory('XML', 'contact');
+        $this->assertEquals('application/x-vnd.kolab.contact',
+                            $format->getMimeType());
+    }
+
+    /**
+     * Test retrieving the document disposition.
+     *
+     * @return NULL
+     */
+    public function testGetDisposition()
+    {
+        $format = Horde_Kolab_Format::factory('XML', 'contact');
+        $this->assertEquals('attachment', $format->getDisposition());
+    }
+}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php
new file mode 100644 (file)
index 0000000..3a2cdef
--- /dev/null
@@ -0,0 +1,143 @@
+<?php
+/**
+ * Test the preferences XML format.
+ *
+ * PHP version 5
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+
+/**
+ * The Autoloader allows us to omit "require/include" statements.
+ */
+require_once 'Horde/Autoloader.php';
+
+
+/**
+ * Test the preferences XML format.
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+class Horde_Kolab_Format_Integration_PreferencesTest
+extends PHPUnit_Framework_TestCase
+{
+
+    /**
+     * Set up testing.
+     *
+     * @return NULL
+     */
+    protected function setUp()
+    {
+        Horde_Nls::setCharset('utf-8');
+    }
+
+    /**
+     * Test preferences format conversion.
+     *
+     * @return NULL
+     */
+    public function testConversionFromOld()
+    {
+        $preferences = new Horde_Kolab_Format_Xml_hprefs_Dummy();
+
+        $xml    = file_get_contents(dirname(__FILE__)
+                                    . '/fixtures/preferences_read_old.xml');
+        $object = $preferences->load($xml);
+        $this->assertContains('test', $object['pref']);
+        $this->assertEquals('Test', $object['application']);
+
+        $object = array('uid' => 1,
+                        'pref' => array('test'),
+                        'categories' => 'Test');
+        $xml    = $preferences->save($object);
+        $expect = file_get_contents(dirname(__FILE__)
+                                    . '/fixtures/preferences_write_old.xml');
+        $this->assertEquals($expect, $xml);
+
+        $object = array('uid' => 1,
+                        'pref' => array('test'),
+                        'application' => 'Test');
+        $xml    = $preferences->save($object);
+        $expect = file_get_contents(dirname(__FILE__)
+                                    . '/fixtures/preferences_write_old.xml');
+        $this->assertEquals($expect, $xml);
+    }
+}
+
+
+/**
+ * A modification to the original preferences handler. This prevents
+ * unpredictable date entries.
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category Kolab
+ * @package  Kolab_Format
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Format
+ */
+class Horde_Kolab_Format_Xml_Hprefs_Dummy extends Horde_Kolab_Format_Xml_Hprefs
+{
+    /**
+     * Save the object creation date.
+     *
+     * @param DOMNode $parent_node The parent node to attach the child
+     *                             to.
+     * @param string  $name        The name of the node.
+     * @param mixed   $value       The value to store.
+     * @param boolean $missing     Has the value been missing?
+     *
+     * @return DOMNode The new child node.
+     */
+    function _saveCreationDate($parent_node, $name, $value, $missing)
+    {
+        // Only create the creation date if it has not been set before
+        if ($missing) {
+            $value = 0;
+        }
+        return $this->_saveDefault($parent_node,
+                                   $name,
+                                   $value,
+                                   array('type' => self::TYPE_DATETIME));
+    }
+
+    /**
+     * Save the object modification date.
+     *
+     * @param DOMNode $parent_node The parent node to attach
+     *                             the child to.
+     * @param string  $name        The name of the node.
+     * @param mixed   $value       The value to store.
+     * @param boolean $missing     Has the value been missing?
+     *
+     * @return DOMNode The new child node.
+     */
+    function _saveModificationDate($parent_node, $name, $value, $missing)
+    {
+        // Always store now as modification date
+        return $this->_saveDefault($parent_node,
+                                   $name,
+                                   0,
+                                   array('type' => self::TYPE_DATETIME));
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php
new file mode 100644 (file)
index 0000000..fb0a167
--- /dev/null
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Test recurrence handling within the Kolab format implementation.
+ *
+ * PHP version 5
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../Autoload.php';
+
+/**
+ * Test recurrence handling
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+class Horde_Kolab_Format_Integration_RecurrenceTest
+extends PHPUnit_Framework_TestCase
+{
+
+    /**
+     * Set up testing.
+     *
+     * @return NULL
+     */
+    protected function setUp()
+    {
+        @include_once 'Horde/Date/Recurrence.php';
+
+        if (!class_exists('Horde_Date_Recurrence')) {
+            $this->markTestSkipped('The Horde_Date_Recurrence class is missing.');
+        }
+
+        Horde_Nls::setCharset('utf-8');
+
+        $this->_oldTimezone = date_default_timezone_get();
+        date_default_timezone_set('Europe/Berlin');
+    }
+
+    public function tearDown()
+    {
+        date_default_timezone_set($this->_oldTimezone);
+    }
+
+    /**
+     * Test for http://bugs.horde.org/ticket/?id=6388
+     *
+     * @return NULL
+     */
+    public function testBug6388()
+    {
+        $xml = Horde_Kolab_Format::factory('XML', 'event');
+
+        // Load XML
+        $recur = file_get_contents(dirname(__FILE__) . '/fixtures/recur.xml');
+
+        // Load XML
+        $xml   = &Horde_Kolab_Format::factory('XML', 'event');
+        $recur = file_get_contents(dirname(__FILE__) . '/fixtures/recur_fail.xml');
+
+        // Check that the xml fails because of a missing interval value
+        try {
+            $xml->load($recur);
+            $this->assertTrue(false);
+        } catch (Exception $e) {
+            $this->assertTrue($e instanceOf Horde_Exception);
+        }
+    }
+
+
+    /**
+     * Test exception handling.
+     *
+     * @return NULL
+     */
+    public function testExceptions()
+    {
+        $xml = Horde_Kolab_Format::factory('XML', 'event');
+
+        // Load XML
+        $recur = file_get_contents(dirname(__FILE__) . '/fixtures/recur.xml');
+
+        $object = $xml->load($recur);
+
+        $r = new Horde_Date_Recurrence($object['start-date']);
+        $r->fromHash($object['recurrence']);
+
+        $this->assertTrue($r->hasRecurEnd());
+        $this->assertTrue($r->hasException(2006, 8, 16));
+        $this->assertTrue($r->hasException(2006, 10, 18));
+
+        $object['recurrence'] = $r->toHash();
+        $recur                = $xml->save($object);
+        $object               = $xml->load($recur);
+
+        $s = new Horde_Date_Recurrence($object['start-date']);
+        $s->fromHash($object['recurrence']);
+
+        $this->assertTrue($s->hasRecurEnd());
+        $this->assertTrue($s->hasException(2006, 8, 16));
+        $this->assertTrue($s->hasException(2006, 10, 18));
+    }
+
+    /**
+     * Test completion handling.
+     *
+     * @return NULL
+     */
+    public function testCompletions()
+    {
+        $xml = Horde_Kolab_Format::factory('XML', 'event');
+
+        $r = new Horde_Date_Recurrence(0);
+        $r->setRecurType(Horde_Date_Recurrence::RECUR_DAILY);
+        $r->addException(1970, 1, 1);
+        $r->addCompletion(1970, 1, 2);
+        $r->addException(1970, 1, 3);
+        $r->addCompletion(1970, 1, 4);
+        $r->setRecurEnd(new Horde_Date(86400*3));
+
+        $object               = array('uid' => 0, 'start-date' => 0,
+                                      'end-date' => 60);
+        $object['recurrence'] = $r->toHash();
+        $recur                = $xml->save($object);
+        $object               = $xml->load($recur);
+
+        $s = new Horde_Date_Recurrence(0);
+        $s->fromHash($object['recurrence']);
+
+        $this->assertTrue($s->hasRecurEnd());
+        $this->assertTrue($s->hasException(1970, 1, 1));
+        $this->assertTrue($s->hasCompletion(1970, 1, 2));
+        $this->assertTrue($s->hasException(1970, 1, 3));
+        $this->assertTrue($s->hasCompletion(1970, 1, 4));
+        $this->assertEquals(2, count($s->getCompletions()));
+        $this->assertEquals(2, count($s->getExceptions()));
+        $this->assertFalse($s->hasActiveRecurrence());
+
+        $s->deleteCompletion(1970, 1, 2);
+        $this->assertEquals(1, count($s->getCompletions()));
+        $s->deleteCompletion(1970, 1, 4);
+        $this->assertEquals(0, count($s->getCompletions()));
+    }
+}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php
new file mode 100644 (file)
index 0000000..cd7b363
--- /dev/null
@@ -0,0 +1,355 @@
+<?php
+/**
+ * Test the XML format implementation.
+ *
+ * PHP version 5
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../Autoload.php';
+
+/**
+ * Test the XML format.
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category   Kolab
+ * @package    Kolab_Format
+ * @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_Format
+ */
+class Horde_Kolab_Format_Integration_XmlTest
+extends PHPUnit_Framework_TestCase
+{
+    /**
+     * Set up testing.
+     *
+     * @return NULL
+     */
+    protected function setUp()
+    {
+        Horde_Nls::setCharset('utf-8');
+    }
+
+
+    /**
+     * Check the preparation of the basic XML structure
+     *
+     * @return NULL
+     */
+    public function testBasic()
+    {
+        $xml = new Horde_Kolab_Format_XML();
+        $xml->_prepareSave();
+        $base = $xml->_xmldoc->saveXML();
+        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\"/>\n",
+                            $base);
+    }
+
+    /**
+     * The resulting XML string should be readable.
+     *
+     * @return NULL
+     */
+    public function testReadable()
+    {
+        $xml = new Horde_Kolab_Format_XML();
+        $xml->_prepareSave();
+        $base = $xml->_xmldoc->saveXML();
+        $xml->_parseXml($base);
+        $this->assertEquals($base, $xml->_xmldoc->saveXML());
+
+    }
+
+    /**
+     * Test adding nodes.
+     *
+     * @return NULL
+     */
+    public function testAdd()
+    {
+        $xml  = new Horde_Kolab_Format_XML();
+        $root = $xml->_prepareSave();
+        $base = $xml->_xmldoc->saveXML();
+
+        // A missing attribute should cause no change if it
+        // is allowed to be empty
+        $xml->_updateNode($root,
+                          array(),
+                          'empty1',
+                          array('value' => Horde_Kolab_Format_Xml::VALUE_MAYBE_MISSING));
+        $this->assertEquals($base, $xml->_xmldoc->saveXML());
+
+        // A missing attribute should cause an error if it
+        // is not allowed to be empty
+        try {
+            $xml->_updateNode($root,
+                              array(),
+                              'empty1',
+                              array('value' => Horde_Kolab_Format_Xml::VALUE_NOT_EMPTY));
+            $this->assertTrue(false);
+        } catch (Exception $e) {
+            $this->assertTrue($e instanceOf Horde_Exception);
+        }
+
+        $xml->_updateNode($root,
+                         array(),
+                         'empty1',
+                         array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
+                               'default' => 'empty1', 'type' => 0));
+        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty1>empty1</empty1>\n</kolab>\n",
+                            $xml->_xmldoc->saveXML());
+
+        try {
+            $xml->_updateNode($root,
+                              array(),
+                              'empty1',
+                              array('value' => Horde_Kolab_Format_Xml::VALUE_CALCULATED,
+                                    'save' => '_unknown'));
+            $this->assertTrue(false);
+        } catch (Exception $e) {
+            $this->assertTrue($e instanceOf Horde_Exception);
+        }
+    }
+
+
+    /**
+     * Test node operations
+     *
+     * @return NULL
+     */
+    public function testNodeOps()
+    {
+        $dxml  = new Horde_Kolab_Format_Xml_Dummy();
+        $droot = $dxml->_prepareSave();
+
+        // Test calculated nodes
+        $dxml->_updateNode($droot,
+                           array(),
+                           'empty2',
+                           array('value' => Horde_Kolab_Format_Xml::VALUE_CALCULATED,
+                                 'save' => 'Value', 'type' => 0));
+        $dxml->_updateNode($droot,
+                           array('present1' => 'present1'),
+                           'present1',
+                           array('value' => Horde_Kolab_Format_Xml::VALUE_CALCULATED,
+                                 'save' => 'Value', 'type' => 0));
+        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty2>empty2: , missing</empty2>\n  <present1>present1: present1</present1>\n</kolab>\n",
+                            $dxml->_xmldoc->saveXML());
+
+        $xml  = new Horde_Kolab_Format_Xml();
+        $root = $xml->_prepareSave();
+        $xml->_updateNode($root,
+                          array(),
+                          'empty1',
+                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
+                                'default' => 'empty1', 'type' => 0));
+
+        // Back to the original object: Test saving a normal value
+        $xml->_updateNode($root,
+                          array('present1' => 'present1'),
+                          'present1',
+                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
+                                'default' => 'empty1', 'type' => 0));
+        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty1>empty1</empty1>\n  <present1>present1</present1>\n</kolab>\n",
+                            $xml->_xmldoc->saveXML());
+
+        // Test overwriting a value
+        $xml->_updateNode($root,
+                          array('present1' => 'new1'),
+                          'present1',
+                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
+                                'default' => 'empty1', 'type' => 0));
+        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty1>empty1</empty1>\n  <present1>new1</present1>\n</kolab>\n",
+                            $xml->_xmldoc->saveXML());
+
+        // Test saving a date
+        $xml->_updateNode($root,
+                          array('date1' => 1175080008),
+                          'date1',
+                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
+                                'default' => 'empty1', 
+                                'type' => Horde_Kolab_Format_Xml::TYPE_DATETIME));
+        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty1>empty1</empty1>\n  <present1>new1</present1>\n  <date1>2007-03-28T11:06:48Z</date1>\n</kolab>\n",
+                            $xml->_xmldoc->saveXML());
+
+        // Now load the data back in
+        $children = $root->childNodes;
+
+        // Test loading a value that may be empty
+        $this->assertEquals(null, $xml->_getXmlData($children,
+                                                    'empty2',
+                                                    array('value' => Horde_Kolab_Format_Xml::VALUE_MAYBE_MISSING,
+                                                          'default' => '', 
+                                                          'type' => Horde_Kolab_Format_Xml::TYPE_STRING)));
+
+        // Test loading a value that may not be empty
+        try {
+            $xml->_getXmlData($children,
+                              'empty2',
+                              array('value' => Horde_Kolab_Format_Xml::VALUE_NOT_EMPTY,
+                                    'default' => '', 
+                                    'type' => Horde_Kolab_Format_Xml::TYPE_STRING));
+            $this->assertTrue(false);
+        } catch (Exception $e) {
+            $this->assertTrue($e instanceOf Horde_Exception);
+        }
+
+        // Test loading a missing value with a default
+        $this->assertEquals(0, $xml->_getXmlData($children,
+                                                 'date2',
+                                                 array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
+                                                       'default' => 0, 
+                                                       'type' => Horde_Kolab_Format_Xml::TYPE_DATETIME)));
+
+        // Test loading a calculated value
+        $this->assertEquals('new1', $dxml->_getXmlData($children,
+                                                       'present1',
+                                                       array('value' => Horde_Kolab_Format_Xml::VALUE_CALCULATED,
+                                                             'func' => '_calculate',
+                                                             'type' => Horde_Kolab_Format_Xml::TYPE_STRING)));
+
+        // Test loading a normal value
+        $this->assertEquals('new1', $xml->_getXmlData($children,
+                                                      'present1',
+                                                      array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
+                                                            'default' => 'empty',
+                                                            'type' => Horde_Kolab_Format_Xml::TYPE_STRING)));
+
+        // Test loading a date value
+        $this->assertEquals(1175080008, $xml->_getXmlData($children,
+                                                          'date1',
+                                                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
+                                                                'default' => 0,
+                                                                'type' => Horde_Kolab_Format_Xml::TYPE_DATETIME)));
+    }
+
+
+    /**
+     * Test load/save
+     *
+     * @return NULL
+     */
+    public function testReleod()
+    {
+        // Save an object and reload it
+        $xml    = new Horde_Kolab_Format_Xml();
+        $result = $xml->save(array('uid'=>'test',
+                                   'body' => 'body',
+                                   'dummy' => 'hello',
+                                   'creation-date' => 1175080008,
+                                   'last-modification-date' => 1175080008,
+                             ));
+        $object = $xml->load($result);
+        $this->assertEquals('body', $object['body']);
+        $this->assertTrue(empty($object['dummy']));
+        $this->assertEquals('public', $object['sensitivity']);
+        $this->assertEquals(1175080008, $object['creation-date']);
+        $this->assertTrue($object['last-modification-date'] != 1175080008);
+        $this->assertEquals('Horde::Kolab', $object['product-id']);
+    }
+
+    /**
+     * Test complex values
+     *
+     * @return NULL
+     */
+    public function testComplex()
+    {
+        // Continue with complex values
+        $xml  = new Horde_Kolab_Format_Xml();
+        $root = $xml->_prepareSave();
+
+        // Test saving a composite value
+        $xml->_updateNode($root,
+                          array('composite1' => array('display-name' => 'test',
+                                                      'smtp-address' => 'test@example.com')),
+                          'composite1', $xml->_fields_simple_person);
+        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <composite1>\n    <display-name>test</display-name>\n    <smtp-address>test@example.com</smtp-address>\n    <uid></uid>\n  </composite1>\n</kolab>\n",
+                            $xml->_xmldoc->saveXML());
+
+        // Test saving multiple values
+        $xml->_updateNode($root,
+                          array('attendee1' => array(array('display-name' => 'test'),
+                                                     array('smtp-address' => 'test@example.com'))),
+                          'attendee1', $xml->_fields_attendee);
+        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <composite1>\n    <display-name>test</display-name>\n    <smtp-address>test@example.com</smtp-address>\n    <uid></uid>\n  </composite1>\n  <attendee1>\n    <display-name>test</display-name>\n    <smtp-address></smtp-address>\n    <status>none</status>\n    <request-response>true</request-response>\n    <role>required</role>\n  </attendee1>\n  <attendee1>\n    <display-name></display-name>\n    <smtp-address>test@example.com</smtp-address>\n    <status>none</status>\n    <request-response>true</request-response>\n    <role>required</role>\n  </attendee1>\n</kolab>\n",
+                            $xml->_xmldoc->saveXML());
+
+        $children = $root->childNodes;
+
+        // Load a composite value
+        $data = $xml->_getXmlData($children,
+                                  'composite1', 
+                                  $xml->_fields_simple_person);
+
+        $this->assertEquals(3, count($data));
+        $this->assertEquals('test@example.com', $data['smtp-address']);
+
+        // Load multiple values
+        $data = $xml->_getXmlData($children,
+                                  'attendee1', 
+                                  $xml->_fields_attendee);
+        $this->assertEquals(2, count($data));
+        $this->assertEquals(5, count($data[0]));
+        $this->assertEquals('', $data[0]['smtp-address']);
+        $this->assertEquals('test@example.com', $data[1]['smtp-address']);
+    }
+}
+
+/**
+ * A dummy XML type
+ *
+ * Copyright 2007-2010 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.
+ *
+ * @category Kolab
+ * @package  Kolab_Format
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Format
+ */
+class Horde_Kolab_Format_Xml_Dummy extends Horde_Kolab_Format_Xml
+{
+    /**
+     * Save the object creation date.
+     *
+     * @param DOMNode $node    The parent node to attach the child
+     *                         to.
+     * @param string  $name    The name of the node.
+     * @param mixed   $value   The value to store.
+     * @param boolean $missing Has the value been missing?
+     *
+     * @return DOMNode The new child node.
+     */
+    function _saveValue($node, $name, $value, $missing)
+    {
+        $result  ='';
+        $result .= $name . ': ';
+        $result .= $value;
+        if ($missing) {
+            $result .= ', missing';
+        }
+
+        return $this->_saveDefault($node, 
+                                   $name, 
+                                   $result, 
+                                   array('type' => self::TYPE_STRING));
+    }
+}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_category.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_category.xml
new file mode 100644 (file)
index 0000000..0fb7c0e
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<contact version="1.0">
+  <uid>1</uid>
+  <body></body>
+  <categories>Test</categories>
+  <creation-date>1970-01-01T00:00:00Z</creation-date>
+  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
+  <sensitivity>public</sensitivity>
+  <product-id>Horde::Kolab</product-id>
+  <name>
+    <full-name>User Name</full-name>
+  </name>
+  <email>
+    <display-name>User Name</display-name>
+    <smtp-address>user@example.org</smtp-address>
+    <uid></uid>
+  </email>
+</contact>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_mail.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_mail.xml
new file mode 100644 (file)
index 0000000..af04840
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<contact version="1.0">
+  <uid>1</uid>
+  <body></body>
+  <categories></categories>
+  <creation-date>1970-01-01T00:00:00Z</creation-date>
+  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
+  <sensitivity>public</sensitivity>
+  <product-id>Horde::Kolab</product-id>
+  <name>
+    <full-name>User Name</full-name>
+  </name>
+  <email>
+    <display-name>User Name</display-name>
+    <smtp-address>user@example.org</smtp-address>
+    <uid></uid>
+  </email>
+</contact>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_pgp.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_pgp.xml
new file mode 100644 (file)
index 0000000..7be0574
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<contact version="1.0">
+  <uid>1</uid>
+  <body></body>
+  <categories></categories>
+  <creation-date>1970-01-01T00:00:00Z</creation-date>
+  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
+  <sensitivity>public</sensitivity>
+  <product-id>Horde::Kolab</product-id>
+  <name>
+    <full-name>User Name</full-name>
+  </name>
+  <email>
+    <display-name>User Name</display-name>
+    <smtp-address>user@example.org</smtp-address>
+    <uid></uid>
+  </email>
+  <pgp-publickey>PGP Test Key</pgp-publickey>
+</contact>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/event_umlaut.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/event_umlaut.xml
new file mode 100644 (file)
index 0000000..a00d2cd
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<event version="1.0" >
+ <product-id>KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource</product-id>
+ <uid>libkcal-543769073.139</uid>
+ <creation-date>2006-03-16T15:00:53Z</creation-date>
+ <last-modification-date>2007-01-25T11:36:40Z</last-modification-date>
+ <sensitivity>public</sensitivity>
+ <pilot-sync-status>1</pilot-sync-status>
+ <start-date>2006-03-15T18:30:00Z</start-date>
+ <summary>Summary</summary>
+ <organizer>
+  <display-name>Orga Nizer</display-name>
+  <smtp-address>orga.nizer@example.com</smtp-address>
+ </organizer>
+ <body>...übbe...</body>
+ <revision>0</revision>
+ <show-time-as>busy</show-time-as>
+ <end-date>2007-03-15T20:00:00Z</end-date>
+</event>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/event_umlaut_broken.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/event_umlaut_broken.xml
new file mode 100644 (file)
index 0000000..dd6893f
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<event version="1.0" >
+ <product-id>KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource</product-id>
+ <uid>libkcal-543769073.139</uid>
+ <creation-date>2006-03-16T15:00:53Z</creation-date>
+ <last-modification-date>2007-01-25T11:36:40Z</last-modification-date>
+ <sensitivity>public</sensitivity>
+ <pilot-sync-status>1</pilot-sync-status>
+ <start-date>2006-03-15T18:30:00Z</start-date>
+ <summary>Summary</summary>
+ <organizer>
+  <display-name>Orga Nizer</display-name>
+  <smtp-address>orga.nizer@example.com</smtp-address>
+ </organizer>
+ <body>...übbe...</body>
+ <revision>0</revision>
+ <show-time-as>busy</show-time-as>
+ <end-date>2007-03-15T20:00:00Z</end-date>
+</event>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/preferences_read_old.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/preferences_read_old.xml
new file mode 100644 (file)
index 0000000..c7ede5c
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<contact version="1.0">
+  <uid>1</uid>
+  <body></body>
+  <creation-date>1970-01-01T00:00:00Z</creation-date>
+  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
+  <sensitivity>public</sensitivity>
+  <product-id>Horde::Kolab</product-id>
+  <categories>Test</categories>
+  <pref>test</pref>
+</contact>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/preferences_write_old.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/preferences_write_old.xml
new file mode 100644 (file)
index 0000000..9a4f983
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<h-prefs version="1.0">
+  <uid>1</uid>
+  <body></body>
+  <categories></categories>
+  <creation-date>1970-01-01T00:00:00Z</creation-date>
+  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
+  <sensitivity>public</sensitivity>
+  <product-id>Horde::Kolab</product-id>
+  <application>Test</application>
+  <pref>test</pref>
+</h-prefs>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/recur.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/recur.xml
new file mode 100644 (file)
index 0000000..63a6b5f
--- /dev/null
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<event version="1.0" >
+ <product-id>KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource</product-id>
+ <uid>libkcal-543769073.139</uid>
+ <creation-date>2006-03-16T15:00:53Z</creation-date>
+ <last-modification-date>2007-01-25T11:36:40Z</last-modification-date>
+ <sensitivity>public</sensitivity>
+ <pilot-sync-status>1</pilot-sync-status>
+ <start-date>2006-03-15T18:30:00Z</start-date>
+ <summary>Summary</summary>
+ <organizer>
+  <display-name>Orga Nizer</display-name>
+  <smtp-address>orga.nizer@example.com</smtp-address>
+ </organizer>
+ <recurrence cycle="weekly" >
+  <interval>1</interval>
+  <day>wednesday</day>
+  <range type="date" >2007-01-24</range>
+  <exclusion>2006-04-05</exclusion>
+  <exclusion>2006-04-12</exclusion>
+  <exclusion>2006-07-19</exclusion>
+  <exclusion>2006-07-26</exclusion>
+  <exclusion>2006-08-02</exclusion>
+  <exclusion>2006-08-09</exclusion>
+  <exclusion>2006-08-16</exclusion>
+  <exclusion>2006-08-23</exclusion>
+  <exclusion>2006-07-12</exclusion>
+  <exclusion>2006-09-06</exclusion>
+  <exclusion>2006-09-13</exclusion>
+  <exclusion>2006-10-18</exclusion>
+  <exclusion>2006-10-25</exclusion>
+  <exclusion>2006-12-27</exclusion>
+  <exclusion>2007-01-17</exclusion>
+  <exclusion>2007-01-10</exclusion>
+  <exclusion>2007-01-03</exclusion>
+ </recurrence>
+ <revision>0</revision>
+ <show-time-as>busy</show-time-as>
+ <end-date>2007-03-15T20:00:00Z</end-date>
+</event>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/recur_fail.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/recur_fail.xml
new file mode 100644 (file)
index 0000000..4c46dd2
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<event version="1.0" >
+ <product-id>KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource</product-id>
+ <uid>libkcal-543769073.139</uid>
+ <creation-date>2006-03-16T15:00:53Z</creation-date>
+ <last-modification-date>2007-01-25T11:36:40Z</last-modification-date>
+ <sensitivity>public</sensitivity>
+ <pilot-sync-status>1</pilot-sync-status>
+ <start-date>2006-03-15T18:30:00Z</start-date>
+ <summary>Summary</summary>
+ <organizer>
+  <display-name>Orga Nizer</display-name>
+  <smtp-address>orga.nizer@example.com</smtp-address>
+ </organizer>
+ <recurrence>
+  <day>wednesday</day>
+  <range type="date" >2007-01-24</range>
+  <exclusion>2006-04-05</exclusion>
+  <exclusion>2006-04-12</exclusion>
+  <exclusion>2006-07-19</exclusion>
+  <exclusion>2006-07-26</exclusion>
+  <exclusion>2006-08-02</exclusion>
+  <exclusion>2006-08-09</exclusion>
+  <exclusion>2006-08-16</exclusion>
+  <exclusion>2006-08-23</exclusion>
+  <exclusion>2006-07-12</exclusion>
+  <exclusion>2006-09-06</exclusion>
+  <exclusion>2006-09-13</exclusion>
+  <exclusion>2006-10-18</exclusion>
+  <exclusion>2006-10-25</exclusion>
+  <exclusion>2006-12-27</exclusion>
+  <exclusion>2007-01-17</exclusion>
+  <exclusion>2007-01-10</exclusion>
+  <exclusion>2007-01-03</exclusion>
+ </recurrence>
+ <revision>0</revision>
+ <show-time-as>busy</show-time-as>
+ <end-date>2006-03-15T20:00:00Z</end-date>
+</event>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/MimeAttrTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/MimeAttrTest.php
deleted file mode 100644 (file)
index 7480931..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * Test Kolab Format MIME attributes
- *
- * PHP version 5
- *
- * @category   Kolab
- * @package    Kolab_Format
- * @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_Format
- */
-
-/**
- * The Autoloader allows us to omit "require/include" statements.
- */
-require_once 'Horde/Autoloader.php';
-
-/**
- * Test Kolab Format MIME attributes
- *
- * Copyright 2007-2010 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.
- *
- * @category   Kolab
- * @package    Kolab_Format
- * @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_Format
- */
-class Horde_Kolab_Format_MimeAttrTest extends PHPUnit_Framework_TestCase
-{
-
-    /**
-     * Set up testing.
-     *
-     * @return NULL
-     */
-    protected function setUp()
-    {
-        Horde_Nls::setCharset('utf-8');
-    }
-
-    /**
-     * Test retrieving the document name.
-     *
-     * @return NULL
-     */
-    public function testGetName()
-    {
-        $format = Horde_Kolab_Format::factory('XML', 'contact');
-        $this->assertEquals('kolab.xml', $format->getName());
-    }
-
-    /**
-     * Test retrieving the document mime type.
-     *
-     * @return NULL
-     */
-    public function testMimeType()
-    {
-        $format = Horde_Kolab_Format::factory('XML', 'contact');
-        $this->assertEquals('application/x-vnd.kolab.contact',
-                            $format->getMimeType());
-    }
-
-    /**
-     * Test retrieving the document disposition.
-     *
-     * @return NULL
-     */
-    public function testGetDisposition()
-    {
-        $format = Horde_Kolab_Format::factory('XML', 'contact');
-        $this->assertEquals('attachment', $format->getDisposition());
-    }
-}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/PreferencesTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/PreferencesTest.php
deleted file mode 100644 (file)
index 6a3615e..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php
-/**
- * Test the preferences XML format.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-
-/**
- * The Autoloader allows us to omit "require/include" statements.
- */
-require_once 'Horde/Autoloader.php';
-
-
-/**
- * Test the preferences XML format.
- *
- * Copyright 2007-2010 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.
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-class Horde_Kolab_Format_PreferencesTest extends PHPUnit_Framework_TestCase
-{
-
-    /**
-     * Set up testing.
-     *
-     * @return NULL
-     */
-    protected function setUp()
-    {
-        Horde_Nls::setCharset('utf-8');
-    }
-
-    /**
-     * Test preferences format conversion.
-     *
-     * @return NULL
-     */
-    public function testConversionFromOld()
-    {
-        $preferences = new Horde_Kolab_Format_Xml_hprefs_Dummy();
-
-        $xml    = file_get_contents(dirname(__FILE__)
-                                    . '/fixtures/preferences_read_old.xml');
-        $object = $preferences->load($xml);
-        $this->assertContains('test', $object['pref']);
-        $this->assertEquals('Test', $object['application']);
-
-        $object = array('uid' => 1,
-                        'pref' => array('test'),
-                        'categories' => 'Test');
-        $xml    = $preferences->save($object);
-        $expect = file_get_contents(dirname(__FILE__)
-                                    . '/fixtures/preferences_write_old.xml');
-        $this->assertEquals($expect, $xml);
-
-        $object = array('uid' => 1,
-                        'pref' => array('test'),
-                        'application' => 'Test');
-        $xml    = $preferences->save($object);
-        $expect = file_get_contents(dirname(__FILE__)
-                                    . '/fixtures/preferences_write_old.xml');
-        $this->assertEquals($expect, $xml);
-    }
-}
-
-
-/**
- * A modification to the original preferences handler. This prevents
- * unpredictable date entries.
- *
- * Copyright 2007-2010 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.
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-class Horde_Kolab_Format_Xml_Hprefs_Dummy extends Horde_Kolab_Format_Xml_Hprefs
-{
-    /**
-     * Save the object creation date.
-     *
-     * @param DOMNode $parent_node The parent node to attach the child
-     *                             to.
-     * @param string  $name        The name of the node.
-     * @param mixed   $value       The value to store.
-     * @param boolean $missing     Has the value been missing?
-     *
-     * @return DOMNode The new child node.
-     */
-    function _saveCreationDate($parent_node, $name, $value, $missing)
-    {
-        // Only create the creation date if it has not been set before
-        if ($missing) {
-            $value = 0;
-        }
-        return $this->_saveDefault($parent_node,
-                                   $name,
-                                   $value,
-                                   array('type' => self::TYPE_DATETIME));
-    }
-
-    /**
-     * Save the object modification date.
-     *
-     * @param DOMNode $parent_node The parent node to attach
-     *                             the child to.
-     * @param string  $name        The name of the node.
-     * @param mixed   $value       The value to store.
-     * @param boolean $missing     Has the value been missing?
-     *
-     * @return DOMNode The new child node.
-     */
-    function _saveModificationDate($parent_node, $name, $value, $missing)
-    {
-        // Always store now as modification date
-        return $this->_saveDefault($parent_node,
-                                   $name,
-                                   0,
-                                   array('type' => self::TYPE_DATETIME));
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/RecurrenceTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/RecurrenceTest.php
deleted file mode 100644 (file)
index 1e070d4..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-<?php
-/**
- * Test recurrence handling within the Kolab format implementation.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-
-/**
- * The Autoloader allows us to omit "require/include" statements.
- */
-require_once 'Horde/Autoloader.php';
-
-/**
- * Test recurrence handling
- *
- * Copyright 2007-2010 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.
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-class Horde_Kolab_Format_RecurrenceTest extends PHPUnit_Framework_TestCase
-{
-
-    /**
-     * Set up testing.
-     *
-     * @return NULL
-     */
-    protected function setUp()
-    {
-        @include_once 'Horde/Date/Recurrence.php';
-
-        if (!class_exists('Horde_Date_Recurrence')) {
-            $this->markTestSkipped('The Horde_Date_Recurrence class is missing.');
-        }
-
-        Horde_Nls::setCharset('utf-8');
-
-        $this->_oldTimezone = date_default_timezone_get();
-        date_default_timezone_set('Europe/Berlin');
-    }
-
-    public function tearDown()
-    {
-        date_default_timezone_set($this->_oldTimezone);
-    }
-
-    /**
-     * Test for http://bugs.horde.org/ticket/?id=6388
-     *
-     * @return NULL
-     */
-    public function testBug6388()
-    {
-        $xml = Horde_Kolab_Format::factory('XML', 'event');
-
-        // Load XML
-        $recur = file_get_contents(dirname(__FILE__) . '/fixtures/recur.xml');
-
-        // Load XML
-        $xml   = &Horde_Kolab_Format::factory('XML', 'event');
-        $recur = file_get_contents(dirname(__FILE__) . '/fixtures/recur_fail.xml');
-
-        // Check that the xml fails because of a missing interval value
-        try {
-            $xml->load($recur);
-            $this->assertTrue(false);
-        } catch (Exception $e) {
-            $this->assertTrue($e instanceOf Horde_Exception);
-        }
-    }
-
-
-    /**
-     * Test exception handling.
-     *
-     * @return NULL
-     */
-    public function testExceptions()
-    {
-        $xml = Horde_Kolab_Format::factory('XML', 'event');
-
-        // Load XML
-        $recur = file_get_contents(dirname(__FILE__) . '/fixtures/recur.xml');
-
-        $object = $xml->load($recur);
-
-        $r = new Horde_Date_Recurrence($object['start-date']);
-        $r->fromHash($object['recurrence']);
-
-        $this->assertTrue($r->hasRecurEnd());
-        $this->assertTrue($r->hasException(2006, 8, 16));
-        $this->assertTrue($r->hasException(2006, 10, 18));
-
-        $object['recurrence'] = $r->toHash();
-        $recur                = $xml->save($object);
-        $object               = $xml->load($recur);
-
-        $s = new Horde_Date_Recurrence($object['start-date']);
-        $s->fromHash($object['recurrence']);
-
-        $this->assertTrue($s->hasRecurEnd());
-        $this->assertTrue($s->hasException(2006, 8, 16));
-        $this->assertTrue($s->hasException(2006, 10, 18));
-    }
-
-    /**
-     * Test completion handling.
-     *
-     * @return NULL
-     */
-    public function testCompletions()
-    {
-        $xml = Horde_Kolab_Format::factory('XML', 'event');
-
-        $r = new Horde_Date_Recurrence(0);
-        $r->setRecurType(Horde_Date_Recurrence::RECUR_DAILY);
-        $r->addException(1970, 1, 1);
-        $r->addCompletion(1970, 1, 2);
-        $r->addException(1970, 1, 3);
-        $r->addCompletion(1970, 1, 4);
-        $r->setRecurEnd(new Horde_Date(86400*3));
-
-        $object               = array('uid' => 0, 'start-date' => 0,
-                                      'end-date' => 60);
-        $object['recurrence'] = $r->toHash();
-        $recur                = $xml->save($object);
-        $object               = $xml->load($recur);
-
-        $s = new Horde_Date_Recurrence(0);
-        $s->fromHash($object['recurrence']);
-
-        $this->assertTrue($s->hasRecurEnd());
-        $this->assertTrue($s->hasException(1970, 1, 1));
-        $this->assertTrue($s->hasCompletion(1970, 1, 2));
-        $this->assertTrue($s->hasException(1970, 1, 3));
-        $this->assertTrue($s->hasCompletion(1970, 1, 4));
-        $this->assertEquals(2, count($s->getCompletions()));
-        $this->assertEquals(2, count($s->getExceptions()));
-        $this->assertFalse($s->hasActiveRecurrence());
-
-        $s->deleteCompletion(1970, 1, 2);
-        $this->assertEquals(1, count($s->getCompletions()));
-        $s->deleteCompletion(1970, 1, 4);
-        $this->assertEquals(0, count($s->getCompletions()));
-    }
-}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/XmlTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/XmlTest.php
deleted file mode 100644 (file)
index fe531f6..0000000
+++ /dev/null
@@ -1,353 +0,0 @@
-<?php
-/**
- * Test the XML format implementation.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-
-/**
- * The Autoloader allows us to omit "require/include" statements.
- */
-require_once 'Horde/Autoloader.php';
-
-/**
- * Test the XML format.
- *
- * Copyright 2007-2010 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.
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-class Horde_Kolab_Format_XmlTest extends PHPUnit_Framework_TestCase
-{
-
-    /**
-     * Set up testing.
-     *
-     * @return NULL
-     */
-    protected function setUp()
-    {
-        Horde_Nls::setCharset('utf-8');
-    }
-
-
-    /**
-     * Check the preparation of the basic XML structure
-     *
-     * @return NULL
-     */
-    public function testBasic()
-    {
-        $xml = new Horde_Kolab_Format_XML();
-        $xml->_prepareSave();
-        $base = $xml->_xmldoc->saveXML();
-        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\"/>\n",
-                            $base);
-    }
-
-    /**
-     * The resulting XML string should be readable.
-     *
-     * @return NULL
-     */
-    public function testReadable()
-    {
-        $xml = new Horde_Kolab_Format_XML();
-        $xml->_prepareSave();
-        $base = $xml->_xmldoc->saveXML();
-        $xml->_parseXml($base);
-        $this->assertEquals($base, $xml->_xmldoc->saveXML());
-
-    }
-
-    /**
-     * Test adding nodes.
-     *
-     * @return NULL
-     */
-    public function testAdd()
-    {
-        $xml  = new Horde_Kolab_Format_XML();
-        $root = $xml->_prepareSave();
-        $base = $xml->_xmldoc->saveXML();
-
-        // A missing attribute should cause no change if it
-        // is allowed to be empty
-        $xml->_updateNode($root,
-                          array(),
-                          'empty1',
-                          array('value' => Horde_Kolab_Format_Xml::VALUE_MAYBE_MISSING));
-        $this->assertEquals($base, $xml->_xmldoc->saveXML());
-
-        // A missing attribute should cause an error if it
-        // is not allowed to be empty
-        try {
-            $xml->_updateNode($root,
-                              array(),
-                              'empty1',
-                              array('value' => Horde_Kolab_Format_Xml::VALUE_NOT_EMPTY));
-            $this->assertTrue(false);
-        } catch (Exception $e) {
-            $this->assertTrue($e instanceOf Horde_Exception);
-        }
-
-        $xml->_updateNode($root,
-                         array(),
-                         'empty1',
-                         array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
-                               'default' => 'empty1', 'type' => 0));
-        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty1>empty1</empty1>\n</kolab>\n",
-                            $xml->_xmldoc->saveXML());
-
-        try {
-            $xml->_updateNode($root,
-                              array(),
-                              'empty1',
-                              array('value' => Horde_Kolab_Format_Xml::VALUE_CALCULATED,
-                                    'save' => '_unknown'));
-            $this->assertTrue(false);
-        } catch (Exception $e) {
-            $this->assertTrue($e instanceOf Horde_Exception);
-        }
-    }
-
-
-    /**
-     * Test node operations
-     *
-     * @return NULL
-     */
-    public function testNodeOps()
-    {
-        $dxml  = new Horde_Kolab_Format_Xml_Dummy();
-        $droot = $dxml->_prepareSave();
-
-        // Test calculated nodes
-        $dxml->_updateNode($droot,
-                           array(),
-                           'empty2',
-                           array('value' => Horde_Kolab_Format_Xml::VALUE_CALCULATED,
-                                 'save' => 'Value', 'type' => 0));
-        $dxml->_updateNode($droot,
-                           array('present1' => 'present1'),
-                           'present1',
-                           array('value' => Horde_Kolab_Format_Xml::VALUE_CALCULATED,
-                                 'save' => 'Value', 'type' => 0));
-        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty2>empty2: , missing</empty2>\n  <present1>present1: present1</present1>\n</kolab>\n",
-                            $dxml->_xmldoc->saveXML());
-
-        $xml  = new Horde_Kolab_Format_Xml();
-        $root = $xml->_prepareSave();
-        $xml->_updateNode($root,
-                          array(),
-                          'empty1',
-                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
-                                'default' => 'empty1', 'type' => 0));
-
-        // Back to the original object: Test saving a normal value
-        $xml->_updateNode($root,
-                          array('present1' => 'present1'),
-                          'present1',
-                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
-                                'default' => 'empty1', 'type' => 0));
-        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty1>empty1</empty1>\n  <present1>present1</present1>\n</kolab>\n",
-                            $xml->_xmldoc->saveXML());
-
-        // Test overwriting a value
-        $xml->_updateNode($root,
-                          array('present1' => 'new1'),
-                          'present1',
-                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
-                                'default' => 'empty1', 'type' => 0));
-        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty1>empty1</empty1>\n  <present1>new1</present1>\n</kolab>\n",
-                            $xml->_xmldoc->saveXML());
-
-        // Test saving a date
-        $xml->_updateNode($root,
-                          array('date1' => 1175080008),
-                          'date1',
-                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
-                                'default' => 'empty1', 
-                                'type' => Horde_Kolab_Format_Xml::TYPE_DATETIME));
-        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <empty1>empty1</empty1>\n  <present1>new1</present1>\n  <date1>2007-03-28T11:06:48Z</date1>\n</kolab>\n",
-                            $xml->_xmldoc->saveXML());
-
-        // Now load the data back in
-        $children = $root->childNodes;
-
-        // Test loading a value that may be empty
-        $this->assertEquals(null, $xml->_getXmlData($children,
-                                                    'empty2',
-                                                    array('value' => Horde_Kolab_Format_Xml::VALUE_MAYBE_MISSING,
-                                                          'default' => '', 
-                                                          'type' => Horde_Kolab_Format_Xml::TYPE_STRING)));
-
-        // Test loading a value that may not be empty
-        try {
-            $xml->_getXmlData($children,
-                              'empty2',
-                              array('value' => Horde_Kolab_Format_Xml::VALUE_NOT_EMPTY,
-                                    'default' => '', 
-                                    'type' => Horde_Kolab_Format_Xml::TYPE_STRING));
-            $this->assertTrue(false);
-        } catch (Exception $e) {
-            $this->assertTrue($e instanceOf Horde_Exception);
-        }
-
-        // Test loading a missing value with a default
-        $this->assertEquals(0, $xml->_getXmlData($children,
-                                                 'date2',
-                                                 array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
-                                                       'default' => 0, 
-                                                       'type' => Horde_Kolab_Format_Xml::TYPE_DATETIME)));
-
-        // Test loading a calculated value
-        $this->assertEquals('new1', $dxml->_getXmlData($children,
-                                                       'present1',
-                                                       array('value' => Horde_Kolab_Format_Xml::VALUE_CALCULATED,
-                                                             'func' => '_calculate',
-                                                             'type' => Horde_Kolab_Format_Xml::TYPE_STRING)));
-
-        // Test loading a normal value
-        $this->assertEquals('new1', $xml->_getXmlData($children,
-                                                      'present1',
-                                                      array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
-                                                            'default' => 'empty',
-                                                            'type' => Horde_Kolab_Format_Xml::TYPE_STRING)));
-
-        // Test loading a date value
-        $this->assertEquals(1175080008, $xml->_getXmlData($children,
-                                                          'date1',
-                                                          array('value' => Horde_Kolab_Format_Xml::VALUE_DEFAULT,
-                                                                'default' => 0,
-                                                                'type' => Horde_Kolab_Format_Xml::TYPE_DATETIME)));
-    }
-
-
-    /**
-     * Test load/save
-     *
-     * @return NULL
-     */
-    public function testReleod()
-    {
-        // Save an object and reload it
-        $xml    = new Horde_Kolab_Format_Xml();
-        $result = $xml->save(array('uid'=>'test',
-                                   'body' => 'body',
-                                   'dummy' => 'hello',
-                                   'creation-date' => 1175080008,
-                                   'last-modification-date' => 1175080008,
-                             ));
-        $object = $xml->load($result);
-        $this->assertEquals('body', $object['body']);
-        $this->assertTrue(empty($object['dummy']));
-        $this->assertEquals('public', $object['sensitivity']);
-        $this->assertEquals(1175080008, $object['creation-date']);
-        $this->assertTrue($object['last-modification-date'] != 1175080008);
-        $this->assertEquals('Horde::Kolab', $object['product-id']);
-    }
-
-    /**
-     * Test complex values
-     *
-     * @return NULL
-     */
-    public function testComplex()
-    {
-        // Continue with complex values
-        $xml  = new Horde_Kolab_Format_Xml();
-        $root = $xml->_prepareSave();
-
-        // Test saving a composite value
-        $xml->_updateNode($root,
-                          array('composite1' => array('display-name' => 'test',
-                                                      'smtp-address' => 'test@example.com')),
-                          'composite1', $xml->_fields_simple_person);
-        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <composite1>\n    <display-name>test</display-name>\n    <smtp-address>test@example.com</smtp-address>\n    <uid></uid>\n  </composite1>\n</kolab>\n",
-                            $xml->_xmldoc->saveXML());
-
-        // Test saving multiple values
-        $xml->_updateNode($root,
-                          array('attendee1' => array(array('display-name' => 'test'),
-                                                     array('smtp-address' => 'test@example.com'))),
-                          'attendee1', $xml->_fields_attendee);
-        $this->assertEquals("<?xml version=\"1.0\"?>\n<kolab version=\"1.0\">\n  <composite1>\n    <display-name>test</display-name>\n    <smtp-address>test@example.com</smtp-address>\n    <uid></uid>\n  </composite1>\n  <attendee1>\n    <display-name>test</display-name>\n    <smtp-address></smtp-address>\n    <status>none</status>\n    <request-response>true</request-response>\n    <role>required</role>\n  </attendee1>\n  <attendee1>\n    <display-name></display-name>\n    <smtp-address>test@example.com</smtp-address>\n    <status>none</status>\n    <request-response>true</request-response>\n    <role>required</role>\n  </attendee1>\n</kolab>\n",
-                            $xml->_xmldoc->saveXML());
-
-        $children = $root->childNodes;
-
-        // Load a composite value
-        $data = $xml->_getXmlData($children,
-                                  'composite1', 
-                                  $xml->_fields_simple_person);
-
-        $this->assertEquals(3, count($data));
-        $this->assertEquals('test@example.com', $data['smtp-address']);
-
-        // Load multiple values
-        $data = $xml->_getXmlData($children,
-                                  'attendee1', 
-                                  $xml->_fields_attendee);
-        $this->assertEquals(2, count($data));
-        $this->assertEquals(5, count($data[0]));
-        $this->assertEquals('', $data[0]['smtp-address']);
-        $this->assertEquals('test@example.com', $data[1]['smtp-address']);
-    }
-}
-
-/**
- * A dummy XML type
- *
- * Copyright 2007-2010 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.
- *
- * @category Kolab
- * @package  Kolab_Format
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Format
- */
-class Horde_Kolab_Format_Xml_Dummy extends Horde_Kolab_Format_Xml
-{
-    /**
-     * Save the object creation date.
-     *
-     * @param DOMNode $node    The parent node to attach the child
-     *                         to.
-     * @param string  $name    The name of the node.
-     * @param mixed   $value   The value to store.
-     * @param boolean $missing Has the value been missing?
-     *
-     * @return DOMNode The new child node.
-     */
-    function _saveValue($node, $name, $value, $missing)
-    {
-        $result  ='';
-        $result .= $name . ': ';
-        $result .= $value;
-        if ($missing) {
-            $result .= ', missing';
-        }
-
-        return $this->_saveDefault($node, 
-                                   $name, 
-                                   $result, 
-                                   array('type' => self::TYPE_STRING));
-    }
-}
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_category.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_category.xml
deleted file mode 100644 (file)
index 0fb7c0e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<contact version="1.0">
-  <uid>1</uid>
-  <body></body>
-  <categories>Test</categories>
-  <creation-date>1970-01-01T00:00:00Z</creation-date>
-  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
-  <sensitivity>public</sensitivity>
-  <product-id>Horde::Kolab</product-id>
-  <name>
-    <full-name>User Name</full-name>
-  </name>
-  <email>
-    <display-name>User Name</display-name>
-    <smtp-address>user@example.org</smtp-address>
-    <uid></uid>
-  </email>
-</contact>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_mail.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_mail.xml
deleted file mode 100644 (file)
index af04840..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<contact version="1.0">
-  <uid>1</uid>
-  <body></body>
-  <categories></categories>
-  <creation-date>1970-01-01T00:00:00Z</creation-date>
-  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
-  <sensitivity>public</sensitivity>
-  <product-id>Horde::Kolab</product-id>
-  <name>
-    <full-name>User Name</full-name>
-  </name>
-  <email>
-    <display-name>User Name</display-name>
-    <smtp-address>user@example.org</smtp-address>
-    <uid></uid>
-  </email>
-</contact>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_pgp.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_pgp.xml
deleted file mode 100644 (file)
index 7be0574..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<contact version="1.0">
-  <uid>1</uid>
-  <body></body>
-  <categories></categories>
-  <creation-date>1970-01-01T00:00:00Z</creation-date>
-  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
-  <sensitivity>public</sensitivity>
-  <product-id>Horde::Kolab</product-id>
-  <name>
-    <full-name>User Name</full-name>
-  </name>
-  <email>
-    <display-name>User Name</display-name>
-    <smtp-address>user@example.org</smtp-address>
-    <uid></uid>
-  </email>
-  <pgp-publickey>PGP Test Key</pgp-publickey>
-</contact>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/event_umlaut.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/event_umlaut.xml
deleted file mode 100644 (file)
index a00d2cd..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<event version="1.0" >
- <product-id>KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource</product-id>
- <uid>libkcal-543769073.139</uid>
- <creation-date>2006-03-16T15:00:53Z</creation-date>
- <last-modification-date>2007-01-25T11:36:40Z</last-modification-date>
- <sensitivity>public</sensitivity>
- <pilot-sync-status>1</pilot-sync-status>
- <start-date>2006-03-15T18:30:00Z</start-date>
- <summary>Summary</summary>
- <organizer>
-  <display-name>Orga Nizer</display-name>
-  <smtp-address>orga.nizer@example.com</smtp-address>
- </organizer>
- <body>...übbe...</body>
- <revision>0</revision>
- <show-time-as>busy</show-time-as>
- <end-date>2007-03-15T20:00:00Z</end-date>
-</event>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/event_umlaut_broken.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/event_umlaut_broken.xml
deleted file mode 100644 (file)
index dd6893f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<event version="1.0" >
- <product-id>KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource</product-id>
- <uid>libkcal-543769073.139</uid>
- <creation-date>2006-03-16T15:00:53Z</creation-date>
- <last-modification-date>2007-01-25T11:36:40Z</last-modification-date>
- <sensitivity>public</sensitivity>
- <pilot-sync-status>1</pilot-sync-status>
- <start-date>2006-03-15T18:30:00Z</start-date>
- <summary>Summary</summary>
- <organizer>
-  <display-name>Orga Nizer</display-name>
-  <smtp-address>orga.nizer@example.com</smtp-address>
- </organizer>
- <body>...übbe...</body>
- <revision>0</revision>
- <show-time-as>busy</show-time-as>
- <end-date>2007-03-15T20:00:00Z</end-date>
-</event>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/preferences_read_old.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/preferences_read_old.xml
deleted file mode 100644 (file)
index c7ede5c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<contact version="1.0">
-  <uid>1</uid>
-  <body></body>
-  <creation-date>1970-01-01T00:00:00Z</creation-date>
-  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
-  <sensitivity>public</sensitivity>
-  <product-id>Horde::Kolab</product-id>
-  <categories>Test</categories>
-  <pref>test</pref>
-</contact>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/preferences_write_old.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/preferences_write_old.xml
deleted file mode 100644 (file)
index 9a4f983..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<h-prefs version="1.0">
-  <uid>1</uid>
-  <body></body>
-  <categories></categories>
-  <creation-date>1970-01-01T00:00:00Z</creation-date>
-  <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
-  <sensitivity>public</sensitivity>
-  <product-id>Horde::Kolab</product-id>
-  <application>Test</application>
-  <pref>test</pref>
-</h-prefs>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/recur.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/recur.xml
deleted file mode 100644 (file)
index 63a6b5f..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<event version="1.0" >
- <product-id>KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource</product-id>
- <uid>libkcal-543769073.139</uid>
- <creation-date>2006-03-16T15:00:53Z</creation-date>
- <last-modification-date>2007-01-25T11:36:40Z</last-modification-date>
- <sensitivity>public</sensitivity>
- <pilot-sync-status>1</pilot-sync-status>
- <start-date>2006-03-15T18:30:00Z</start-date>
- <summary>Summary</summary>
- <organizer>
-  <display-name>Orga Nizer</display-name>
-  <smtp-address>orga.nizer@example.com</smtp-address>
- </organizer>
- <recurrence cycle="weekly" >
-  <interval>1</interval>
-  <day>wednesday</day>
-  <range type="date" >2007-01-24</range>
-  <exclusion>2006-04-05</exclusion>
-  <exclusion>2006-04-12</exclusion>
-  <exclusion>2006-07-19</exclusion>
-  <exclusion>2006-07-26</exclusion>
-  <exclusion>2006-08-02</exclusion>
-  <exclusion>2006-08-09</exclusion>
-  <exclusion>2006-08-16</exclusion>
-  <exclusion>2006-08-23</exclusion>
-  <exclusion>2006-07-12</exclusion>
-  <exclusion>2006-09-06</exclusion>
-  <exclusion>2006-09-13</exclusion>
-  <exclusion>2006-10-18</exclusion>
-  <exclusion>2006-10-25</exclusion>
-  <exclusion>2006-12-27</exclusion>
-  <exclusion>2007-01-17</exclusion>
-  <exclusion>2007-01-10</exclusion>
-  <exclusion>2007-01-03</exclusion>
- </recurrence>
- <revision>0</revision>
- <show-time-as>busy</show-time-as>
- <end-date>2007-03-15T20:00:00Z</end-date>
-</event>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/recur_fail.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/recur_fail.xml
deleted file mode 100644 (file)
index 4c46dd2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<event version="1.0" >
- <product-id>KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource</product-id>
- <uid>libkcal-543769073.139</uid>
- <creation-date>2006-03-16T15:00:53Z</creation-date>
- <last-modification-date>2007-01-25T11:36:40Z</last-modification-date>
- <sensitivity>public</sensitivity>
- <pilot-sync-status>1</pilot-sync-status>
- <start-date>2006-03-15T18:30:00Z</start-date>
- <summary>Summary</summary>
- <organizer>
-  <display-name>Orga Nizer</display-name>
-  <smtp-address>orga.nizer@example.com</smtp-address>
- </organizer>
- <recurrence>
-  <day>wednesday</day>
-  <range type="date" >2007-01-24</range>
-  <exclusion>2006-04-05</exclusion>
-  <exclusion>2006-04-12</exclusion>
-  <exclusion>2006-07-19</exclusion>
-  <exclusion>2006-07-26</exclusion>
-  <exclusion>2006-08-02</exclusion>
-  <exclusion>2006-08-09</exclusion>
-  <exclusion>2006-08-16</exclusion>
-  <exclusion>2006-08-23</exclusion>
-  <exclusion>2006-07-12</exclusion>
-  <exclusion>2006-09-06</exclusion>
-  <exclusion>2006-09-13</exclusion>
-  <exclusion>2006-10-18</exclusion>
-  <exclusion>2006-10-25</exclusion>
-  <exclusion>2006-12-27</exclusion>
-  <exclusion>2007-01-17</exclusion>
-  <exclusion>2007-01-10</exclusion>
-  <exclusion>2007-01-03</exclusion>
- </recurrence>
- <revision>0</revision>
- <show-time-as>busy</show-time-as>
- <end-date>2006-03-15T20:00:00Z</end-date>
-</event>
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/phpunit.xml b/framework/Kolab_Format/test/Horde/Kolab/Format/phpunit.xml
new file mode 100644 (file)
index 0000000..0148736
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit>
+  <filter>
+    <whitelist>
+      <directory suffix=".php">../../../../lib</directory>
+    </whitelist>
+  </filter>
+</phpunit>