summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@pardus.de>2010-02-17 07:34:26 (GMT)
committerGunnar Wrobel <wrobel@pardus.de>2010-02-17 07:34:26 (GMT)
commit24ba323874b546541545449901b1572f76e271dc (patch)
tree3ca4201df185772f716b60823daae168a2afe01a /test
parent0e7067674f77d9cc940a96a1480af0820ee0ee82 (diff)
downloadkolab-webadmin-24ba323874b546541545449901b1572f76e271dc.tar.gz
Start adding the standard unit test suite.
Diffstat (limited to 'test')
-rw-r--r--test/KolabAdmin/AllTests.php83
-rw-r--r--test/KolabAdmin/TestInit.php25
-rw-r--r--test/KolabAdmin/Unit/BaseTest.php38
3 files changed, 146 insertions, 0 deletions
diff --git a/test/KolabAdmin/AllTests.php b/test/KolabAdmin/AllTests.php
new file mode 100644
index 0000000..b3acc43
--- /dev/null
+++ b/test/KolabAdmin/AllTests.php
@@ -0,0 +1,83 @@
+<?php
+/**
+ * All tests for the KolabAdmin application.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package KolabAdmin
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=KolabAdmin
+ */
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'KolabAdmin_AllTests::main');
+}
+
+/**
+ * Initialize testing for this application.
+ */
+require_once 'TestInit.php';
+
+/**
+ * Combine the tests for this package.
+ *
+ * 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 KolabAdmin
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=KolabAdmin
+ */
+class KolabAdmin_AllTests
+{
+ /**
+ * Main entry point for running the suite.
+ *
+ * @return NULL
+ */
+ public static function main()
+ {
+ PHPUnit_TextUI_TestRunner::run(self::suite());
+ }
+
+ /**
+ * Collect the unit tests of this directory into a new suite.
+ *
+ * @return PHPUnit_Framework_TestSuite The test suite.
+ */
+ public static function suite()
+ {
+ // Catch strict standards
+ error_reporting(E_ALL | E_STRICT);
+
+ // Build the suite
+ $suite = new PHPUnit_Framework_TestSuite('KolabAdmin');
+
+ $basedir = dirname(__FILE__);
+ $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/');
+
+ foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) {
+ if ($file->isFile() && preg_match('/Test.php$/', $file->getFilename())) {
+ $pathname = $file->getPathname();
+ require $pathname;
+
+ $class = str_replace(DIRECTORY_SEPARATOR, '_',
+ preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname));
+ $suite->addTestSuite('KolabAdmin_' . $class);
+ }
+ }
+
+ return $suite;
+ }
+
+}
+
+if (PHPUnit_MAIN_METHOD == 'KolabAdmin_AllTests::main') {
+ KolabAdmin_AllTests::main();
+}
diff --git a/test/KolabAdmin/TestInit.php b/test/KolabAdmin/TestInit.php
new file mode 100644
index 0000000..b05e0d4
--- /dev/null
+++ b/test/KolabAdmin/TestInit.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Initialize testing for this application.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package KolabAdmin
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=KolabAdmin
+ */
+
+/**
+ * The Autoloader allows us to omit "require/include" statements.
+ */
+require_once 'Horde/Autoloader.php';
+
+if (!defined('KOWARD_BASE')) {
+ define('KOWARD_BASE', dirname(__FILE__) . '/../');
+}
+
+/* Set up the application class and controller loading */
+Horde_Autoloader::addClassPattern('/^KolabAdmin_/', KOWARD_BASE . '/lib/');
+Horde_Autoloader::addClassPattern('/^KolabAdmin_/', KOWARD_BASE . '/app/controllers/');
diff --git a/test/KolabAdmin/Unit/BaseTest.php b/test/KolabAdmin/Unit/BaseTest.php
new file mode 100644
index 0000000..6cc7ea0
--- /dev/null
+++ b/test/KolabAdmin/Unit/BaseTest.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Test the webadmin code.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package KolabAdmin
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=KolabAdmin
+ */
+
+/**
+ * Require the tested classes.
+ */
+require_once dirname(__FILE__) . '/../../../php/admin/include/KolabLDAP.php';
+
+/**
+ * Test the webadmin code.
+ *
+ * Copyright 2010 Klarälvdalens Datakonsult AB
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package KolabAdmin
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=KolabAdmin
+ */
+class KolabAdmin_Unit_BaseTest extends PHPUnit_Framework_TestCase
+{
+ public function testSomething()
+ {
+ }
+} \ No newline at end of file