From d7ab73f4a9a5afc41d985798c5fff3828f2c2cda Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Sun, 21 Feb 2010 09:19:02 +0100 Subject: A first working test. This works only with an installed server right now but this results from the current code structure that simply allows no mocking/stubbing. --- test/KolabAdmin/Unit/BaseTest.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/KolabAdmin/Unit/BaseTest.php b/test/KolabAdmin/Unit/BaseTest.php index 4b36d55..9ee2d41 100644 --- a/test/KolabAdmin/Unit/BaseTest.php +++ b/test/KolabAdmin/Unit/BaseTest.php @@ -32,7 +32,21 @@ require_once dirname(__FILE__) . '/../../../lib/KolabAdmin/Ldap.php'; */ class KolabAdmin_Unit_BaseTest extends PHPUnit_Framework_TestCase { - public function testSomething() + public function setUp() { + $_SESSION = array(); + require '/kolab/etc/kolab/session_vars.php'; } -} \ No newline at end of file + + public function testCountmailReturnsZeroOnNonExistantMail() + { + $ldap = new KolabLdap(); + $this->assertEquals( + 0, + $ldap->countMail($_SESSION['base_dn'], 'certainly@does@not@exist') + ); + } +} + +/** short circuit the debug function. */ +function debug() {}; \ No newline at end of file -- cgit v0.12