From: Gunnar Wrobel
Date: Wed, 2 Dec 2009 21:14:34 +0000 (+0100)
Subject: Reorganize test suite.
X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=02e4235cef0e31c14950b154d808db83e8140fb3;p=horde.git
Reorganize test suite.
---
diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/AllTests.php b/framework/Kolab_Format/test/Horde/Kolab/Format/AllTests.php
index 8dba17f2e..571fdafab 100644
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/AllTests.php
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/AllTests.php
@@ -4,11 +4,12 @@
*
* PHP version 5
*
- * @category Kolab
- * @package Kolab_Format
- * @author Gunnar Wrobel
- * @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
+ * @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
+ * @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
index 000000000..08ec31f5e
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Autoload.php
@@ -0,0 +1,32 @@
+
+ * @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
index cbff2f2d9..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/ContactTest.php
+++ /dev/null
@@ -1,209 +0,0 @@
-
- * @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
- * @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
- * @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
- * @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
index 7d8a1da5e..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/EventTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-
- * @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
- * @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
index 000000000..e39fc8d91
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php
@@ -0,0 +1,211 @@
+
+ * @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
+ * @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
+ * @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
+ * @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
index 000000000..640f0592d
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php
@@ -0,0 +1,81 @@
+
+ * @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
+ * @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
index 000000000..d936c13d9
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php
@@ -0,0 +1,81 @@
+
+ * @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
+ * @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
index 000000000..3a2cdefec
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php
@@ -0,0 +1,143 @@
+
+ * @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
+ * @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
+ * @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
index 000000000..fb0a1679a
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php
@@ -0,0 +1,162 @@
+
+ * @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
+ * @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
index 000000000..cd7b3637e
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php
@@ -0,0 +1,355 @@
+
+ * @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
+ * @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("\n\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("\n\n empty1\n\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("\n\n empty2: , missing\n present1: present1\n\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("\n\n empty1\n present1\n\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("\n\n empty1\n new1\n\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("\n\n empty1\n new1\n 2007-03-28T11:06:48Z\n\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("\n\n \n test\n test@example.com\n \n \n\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("\n\n \n test\n test@example.com\n \n \n \n test\n \n none\n true\n required\n \n \n \n test@example.com\n none\n true\n required\n \n\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
+ * @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
index 000000000..0fb7c0eec
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_category.xml
@@ -0,0 +1,18 @@
+
+
+ 1
+
+ Test
+ 1970-01-01T00:00:00Z
+ 1970-01-01T00:00:00Z
+ public
+ Horde::Kolab
+
+ User Name
+
+
+ User Name
+ user@example.org
+
+
+
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
index 000000000..af0484044
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_mail.xml
@@ -0,0 +1,18 @@
+
+
+ 1
+
+
+ 1970-01-01T00:00:00Z
+ 1970-01-01T00:00:00Z
+ public
+ Horde::Kolab
+
+ User Name
+
+
+ User Name
+ user@example.org
+
+
+
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
index 000000000..7be05745d
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/contact_pgp.xml
@@ -0,0 +1,19 @@
+
+
+ 1
+
+
+ 1970-01-01T00:00:00Z
+ 1970-01-01T00:00:00Z
+ public
+ Horde::Kolab
+
+ User Name
+
+
+ User Name
+ user@example.org
+
+
+ PGP Test Key
+
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
index 000000000..a00d2cd81
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/event_umlaut.xml
@@ -0,0 +1,19 @@
+
+
+ KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource
+ libkcal-543769073.139
+ 2006-03-16T15:00:53Z
+ 2007-01-25T11:36:40Z
+ public
+ 1
+ 2006-03-15T18:30:00Z
+ Summary
+
+ Orga Nizer
+ orga.nizer@example.com
+
+ ...übbe...
+ 0
+ busy
+ 2007-03-15T20:00:00Z
+
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
index 000000000..dd6893fee
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/event_umlaut_broken.xml
@@ -0,0 +1,19 @@
+
+
+ KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource
+ libkcal-543769073.139
+ 2006-03-16T15:00:53Z
+ 2007-01-25T11:36:40Z
+ public
+ 1
+ 2006-03-15T18:30:00Z
+ Summary
+
+ Orga Nizer
+ orga.nizer@example.com
+
+ ...übbe...
+ 0
+ busy
+ 2007-03-15T20:00:00Z
+
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
index 000000000..c7ede5c19
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/preferences_read_old.xml
@@ -0,0 +1,11 @@
+
+
+ 1
+
+ 1970-01-01T00:00:00Z
+ 1970-01-01T00:00:00Z
+ public
+ Horde::Kolab
+ Test
+ test
+
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
index 000000000..9a4f9835b
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/preferences_write_old.xml
@@ -0,0 +1,12 @@
+
+
+ 1
+
+
+ 1970-01-01T00:00:00Z
+ 1970-01-01T00:00:00Z
+ public
+ Horde::Kolab
+ Test
+ test
+
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
index 000000000..63a6b5f62
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/recur.xml
@@ -0,0 +1,40 @@
+
+
+ KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource
+ libkcal-543769073.139
+ 2006-03-16T15:00:53Z
+ 2007-01-25T11:36:40Z
+ public
+ 1
+ 2006-03-15T18:30:00Z
+ Summary
+
+ Orga Nizer
+ orga.nizer@example.com
+
+
+ 1
+ wednesday
+ 2007-01-24
+ 2006-04-05
+ 2006-04-12
+ 2006-07-19
+ 2006-07-26
+ 2006-08-02
+ 2006-08-09
+ 2006-08-16
+ 2006-08-23
+ 2006-07-12
+ 2006-09-06
+ 2006-09-13
+ 2006-10-18
+ 2006-10-25
+ 2006-12-27
+ 2007-01-17
+ 2007-01-10
+ 2007-01-03
+
+ 0
+ busy
+ 2007-03-15T20:00:00Z
+
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
index 000000000..4c46dd27d
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/fixtures/recur_fail.xml
@@ -0,0 +1,39 @@
+
+
+ KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource
+ libkcal-543769073.139
+ 2006-03-16T15:00:53Z
+ 2007-01-25T11:36:40Z
+ public
+ 1
+ 2006-03-15T18:30:00Z
+ Summary
+
+ Orga Nizer
+ orga.nizer@example.com
+
+
+ wednesday
+ 2007-01-24
+ 2006-04-05
+ 2006-04-12
+ 2006-07-19
+ 2006-07-26
+ 2006-08-02
+ 2006-08-09
+ 2006-08-16
+ 2006-08-23
+ 2006-07-12
+ 2006-09-06
+ 2006-09-13
+ 2006-10-18
+ 2006-10-25
+ 2006-12-27
+ 2007-01-17
+ 2007-01-10
+ 2007-01-03
+
+ 0
+ busy
+ 2006-03-15T20:00:00Z
+
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
index 748093134..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/MimeAttrTest.php
+++ /dev/null
@@ -1,81 +0,0 @@
-
- * @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
- * @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
index 6a3615e5d..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/PreferencesTest.php
+++ /dev/null
@@ -1,140 +0,0 @@
-
- * @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
- * @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
- * @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
index 1e070d4a2..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/RecurrenceTest.php
+++ /dev/null
@@ -1,159 +0,0 @@
-
- * @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
- * @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
index fe531f642..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/XmlTest.php
+++ /dev/null
@@ -1,353 +0,0 @@
-
- * @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
- * @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("\n\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("\n\n empty1\n\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("\n\n empty2: , missing\n present1: present1\n\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("\n\n empty1\n present1\n\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("\n\n empty1\n new1\n\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("\n\n empty1\n new1\n 2007-03-28T11:06:48Z\n\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("\n\n \n test\n test@example.com\n \n \n\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("\n\n \n test\n test@example.com\n \n \n \n test\n \n none\n true\n required\n \n \n \n test@example.com\n none\n true\n required\n \n\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
- * @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
index 0fb7c0eec..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_category.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- 1
-
- Test
- 1970-01-01T00:00:00Z
- 1970-01-01T00:00:00Z
- public
- Horde::Kolab
-
- User Name
-
-
- User Name
- user@example.org
-
-
-
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
index af0484044..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_mail.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- 1
-
-
- 1970-01-01T00:00:00Z
- 1970-01-01T00:00:00Z
- public
- Horde::Kolab
-
- User Name
-
-
- User Name
- user@example.org
-
-
-
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
index 7be05745d..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/contact_pgp.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- 1
-
-
- 1970-01-01T00:00:00Z
- 1970-01-01T00:00:00Z
- public
- Horde::Kolab
-
- User Name
-
-
- User Name
- user@example.org
-
-
- PGP Test Key
-
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
index a00d2cd81..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/event_umlaut.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource
- libkcal-543769073.139
- 2006-03-16T15:00:53Z
- 2007-01-25T11:36:40Z
- public
- 1
- 2006-03-15T18:30:00Z
- Summary
-
- Orga Nizer
- orga.nizer@example.com
-
- ...übbe...
- 0
- busy
- 2007-03-15T20:00:00Z
-
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
index dd6893fee..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/event_umlaut_broken.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource
- libkcal-543769073.139
- 2006-03-16T15:00:53Z
- 2007-01-25T11:36:40Z
- public
- 1
- 2006-03-15T18:30:00Z
- Summary
-
- Orga Nizer
- orga.nizer@example.com
-
- ...übbe...
- 0
- busy
- 2007-03-15T20:00:00Z
-
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
index c7ede5c19..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/preferences_read_old.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- 1
-
- 1970-01-01T00:00:00Z
- 1970-01-01T00:00:00Z
- public
- Horde::Kolab
- Test
- test
-
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
index 9a4f9835b..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/preferences_write_old.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- 1
-
-
- 1970-01-01T00:00:00Z
- 1970-01-01T00:00:00Z
- public
- Horde::Kolab
- Test
- test
-
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
index 63a6b5f62..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/recur.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
- KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource
- libkcal-543769073.139
- 2006-03-16T15:00:53Z
- 2007-01-25T11:36:40Z
- public
- 1
- 2006-03-15T18:30:00Z
- Summary
-
- Orga Nizer
- orga.nizer@example.com
-
-
- 1
- wednesday
- 2007-01-24
- 2006-04-05
- 2006-04-12
- 2006-07-19
- 2006-07-26
- 2006-08-02
- 2006-08-09
- 2006-08-16
- 2006-08-23
- 2006-07-12
- 2006-09-06
- 2006-09-13
- 2006-10-18
- 2006-10-25
- 2006-12-27
- 2007-01-17
- 2007-01-10
- 2007-01-03
-
- 0
- busy
- 2007-03-15T20:00:00Z
-
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
index 4c46dd27d..000000000
--- a/framework/Kolab_Format/test/Horde/Kolab/Format/fixtures/recur_fail.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
- KOrganizer 3.3 (proko2 branch after 2.1.5), Kolab resource
- libkcal-543769073.139
- 2006-03-16T15:00:53Z
- 2007-01-25T11:36:40Z
- public
- 1
- 2006-03-15T18:30:00Z
- Summary
-
- Orga Nizer
- orga.nizer@example.com
-
-
- wednesday
- 2007-01-24
- 2006-04-05
- 2006-04-12
- 2006-07-19
- 2006-07-26
- 2006-08-02
- 2006-08-09
- 2006-08-16
- 2006-08-23
- 2006-07-12
- 2006-09-06
- 2006-09-13
- 2006-10-18
- 2006-10-25
- 2006-12-27
- 2007-01-17
- 2007-01-10
- 2007-01-03
-
- 0
- busy
- 2006-03-15T20:00:00Z
-
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
index 000000000..0148736fe
--- /dev/null
+++ b/framework/Kolab_Format/test/Horde/Kolab/Format/phpunit.xml
@@ -0,0 +1,8 @@
+
+
+
+
+ ../../../../lib
+
+
+