Test the person object.
authorGunnar Wrobel <p@rdus.de>
Thu, 9 Apr 2009 05:45:42 +0000 (07:45 +0200)
committerGunnar Wrobel <p@rdus.de>
Thu, 9 Apr 2009 09:35:38 +0000 (11:35 +0200)
framework/Kolab_Server/test/Horde/Kolab/Server/PersonTest.php [new file with mode: 0644]

diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/PersonTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/PersonTest.php
new file mode 100644 (file)
index 0000000..ead2c25
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Test the person object.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * The Autoloader allows us to omit "require/include" statements.
+ */
+require_once 'Horde/Autoloader.php';
+
+/**
+ * Test the person object.
+ *
+ * Copyright 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_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_PersonTest extends Horde_Kolab_Test_Server
+{
+    /**
+     * Objects used within this test
+     *
+     * @var array
+     */
+    private $objects = array(
+        /* Default dummy person */
+        array(
+            'type' => 'Horde_Kolab_Server_Object_Person',
+            Horde_Kolab_Server_Object_Person::ATTRIBUTE_CN           => '123',
+            Horde_Kolab_Server_Object_Person::ATTRIBUTE_SN           => '123',
+            Horde_Kolab_Server_Object_Person::ATTRIBUTE_USERPASSWORD => '123',
+        ),
+        /* Invalid person (no sn) */
+        array(
+            'type' => 'Horde_Kolab_Server_Object_Person',
+            Horde_Kolab_Server_Object_Person::ATTRIBUTE_CN           => '123',
+            Horde_Kolab_Server_Object_Person::ATTRIBUTE_USERPASSWORD => '123',
+        ),
+    );
+
+    /**
+     * Test ID generation for a person.
+     *
+     * @return NULL
+     */
+    public function testGenerateId()
+    {
+        $this->assertEquals('cn=123',
+                            Horde_Kolab_Server_Object_Person::generateId($this->objects[0]));
+    }
+
+    /**
+     * Test adding invalid user.
+     *
+     * @dataProvider provideServers
+     * @expectedException Horde_Kolab_Server_Exception
+     *
+     * @return NULL
+     */
+    public function testAddInvalidPerson($server)
+    {
+        $result = $server->add($this->objects[2]);
+    }
+
+}