--- /dev/null
+<?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]);
+ }
+
+}