From e0d49365f584d8822a44cced8169601cb9e6c854 Mon Sep 17 00:00:00 2001
From: Gunnar Wrobel
Date: Mon, 9 Aug 2010 08:10:22 +0200
Subject: [PATCH] Start adding an Imp test suite.
---
imp/lib/tests/Imp/AllTests.php | 45 +++++++++++++++++++++++
imp/lib/tests/Imp/Autoload.php | 36 +++++++++++++++++++
imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php | 48 +++++++++++++++++++++++++
imp/lib/tests/Imp/phpunit.xml | 8 +++++
4 files changed, 137 insertions(+)
create mode 100644 imp/lib/tests/Imp/AllTests.php
create mode 100644 imp/lib/tests/Imp/Autoload.php
create mode 100644 imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php
create mode 100644 imp/lib/tests/Imp/phpunit.xml
diff --git a/imp/lib/tests/Imp/AllTests.php b/imp/lib/tests/Imp/AllTests.php
new file mode 100644
index 000000000..8c1da100d
--- /dev/null
+++ b/imp/lib/tests/Imp/AllTests.php
@@ -0,0 +1,45 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Imp
+ */
+
+/**
+ * Define the main method
+ */
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'Imp_AllTests::main');
+}
+
+/**
+ * Prepare the test setup.
+ */
+require_once 'Horde/Test/AllTests.php';
+
+/**
+ * All tests for the Imp:: package.
+ *
+ * @category Horde
+ * @package IMP
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Imp
+ */
+class Imp_AllTests extends Horde_Test_AllTests
+{
+}
+
+Imp_AllTests::init('Imp', __FILE__);
+
+if (PHPUnit_MAIN_METHOD == 'Imp_AllTests::main') {
+ Imp_AllTests::main();
+}
diff --git a/imp/lib/tests/Imp/Autoload.php b/imp/lib/tests/Imp/Autoload.php
new file mode 100644
index 000000000..3fccc6475
--- /dev/null
+++ b/imp/lib/tests/Imp/Autoload.php
@@ -0,0 +1,36 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Imp
+ */
+
+if (!spl_autoload_functions()) {
+ spl_autoload_register(
+ create_function(
+ '$class',
+ '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class);'
+ . 'if (substr($filename, 0, 10) == "IMP/Horde/") {'
+ . ' $filename = substr($filename, 10);'
+ . ' $filename = dirname(__FILE__) . "/../../$filename";'
+ . '} else if (substr($filename, 0, 4) == "IMP/") {'
+ . ' $filename = substr($filename, 4);'
+ . ' $filename = dirname(__FILE__) . "/../../$filename";'
+ . '}'
+ . '$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);
diff --git a/imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php b/imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php
new file mode 100644
index 000000000..ccf137b60
--- /dev/null
+++ b/imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php
@@ -0,0 +1,48 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Imp
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the itip response handling.
+ *
+ * Copyright 2002-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @category Horde
+ * @package IMP
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel
+ * @license http://www.fsf.org/copyleft/gpl.html GPL
+ * @link http://pear.horde.org/index.php?package=Imp
+ */
+class Imp_Unit_Mime_Viewer_ItipTest
+extends PHPUnit_Framework_TestCase
+{
+ public function testMinimalItipHandlingSteps()
+ {
+ $viewer = $this->getViewer();
+ }
+
+ private function getViewer()
+ {
+ $part = new Horde_Mime_Part();
+ return new IMP_Horde_Mime_Viewer_Itip($part);
+ }
+}
diff --git a/imp/lib/tests/Imp/phpunit.xml b/imp/lib/tests/Imp/phpunit.xml
new file mode 100644
index 000000000..5d19e9d58
--- /dev/null
+++ b/imp/lib/tests/Imp/phpunit.xml
@@ -0,0 +1,8 @@
+
+
+
+
+ ../..
+
+
+
--
2.11.0