Start adding an Imp test suite.
authorGunnar Wrobel <p@rdus.de>
Mon, 9 Aug 2010 06:10:22 +0000 (08:10 +0200)
committerGunnar Wrobel <p@rdus.de>
Wed, 25 Aug 2010 17:21:39 +0000 (19:21 +0200)
imp/lib/tests/Imp/AllTests.php [new file with mode: 0644]
imp/lib/tests/Imp/Autoload.php [new file with mode: 0644]
imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php [new file with mode: 0644]
imp/lib/tests/Imp/phpunit.xml [new file with mode: 0644]

diff --git a/imp/lib/tests/Imp/AllTests.php b/imp/lib/tests/Imp/AllTests.php
new file mode 100644 (file)
index 0000000..8c1da10
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * All tests for the Imp:: package.
+ *
+ * PHP version 5
+ *
+ * @category   Horde
+ * @package    IMP
+ * @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=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 <wrobel@pardus.de>
+ * @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 (file)
index 0000000..3fccc64
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Setup autoloading for the tests.
+ *
+ * PHP version 5
+ *
+ * @category   Horde
+ * @package    IMP
+ * @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=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 (file)
index 0000000..ccf137b
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Test the itip response handling.
+ *
+ * PHP version 5
+ *
+ * @category   Horde
+ * @package    IMP
+ * @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=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 <wrobel@pardus.de>
+ * @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 (file)
index 0000000..5d19e9d
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit>
+  <filter>
+    <whitelist>
+      <directory suffix=".php">../..</directory>
+    </whitelist>
+  </filter>
+</phpunit>