[Mapbender-commits] r4739 - trunk/mapbender/test/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Sat Sep 26 14:39:16 EDT 2009
Author: kmq
Date: 2009-09-26 14:39:15 -0400 (Sat, 26 Sep 2009)
New Revision: 4739
Added:
trunk/mapbender/test/http/classes/UserTest.php
Modified:
trunk/mapbender/test/http/classes/GroupTest.php
Log:
tests for the classes group and user
Modified: trunk/mapbender/test/http/classes/GroupTest.php
===================================================================
--- trunk/mapbender/test/http/classes/GroupTest.php 2009-09-26 18:37:47 UTC (rev 4738)
+++ trunk/mapbender/test/http/classes/GroupTest.php 2009-09-26 18:39:15 UTC (rev 4739)
@@ -6,14 +6,16 @@
{
var $someGroup_name = "demo";
var $someGroup_description = "Demo Group zum Test";
-
+
public function testCreate()
{
$group = new Group(null);
- $group->name = $someGroup_name;
- $group->description = $someGroup_description;
+ $group->name = $this->someGroup_name;
+ $group->description = $this->someGroup_description;
- $create_message="Group creation failed";
+
+ $this->assertNotNull($group);
+
try{
$create_result = $group->create();
}
@@ -21,11 +23,13 @@
{
$this->assertEquals($E->getMessage(), 'Could not insert new group');
}
- $this->assertTrue($create_result,$create_message);
-
- $change_result = $group->change(array());
+ $this->assertNotNull($create_result);
+
+
+ $change_result = $group->change(null);
$this->assertTrue($change_result);
-
+
+
try{
$commit_result = $group->commit();
}
@@ -36,19 +40,22 @@
$this->assertTrue($commit_result);
}
-
-
- public function testRemove()
+
+ /*
+ * @depends testCreate
+ */
+ public function testDelete()
{
- $group = Group::byName($someGroup_name);
+ $group = Group::byName($this->someGroup_name);
$this->assertNotNull($group);
- $group->remove();
+ $remove_result = $group->remove();
+ $this->assertTrue($remove_result);
$group = null;
- $group = Group::byName($someGroup_name);
+ $group = Group::byName($this->someGroup_name);
$this->assertNull($group);
}
}
-?>
\ No newline at end of file
+?>
Added: trunk/mapbender/test/http/classes/UserTest.php
===================================================================
--- trunk/mapbender/test/http/classes/UserTest.php (rev 0)
+++ trunk/mapbender/test/http/classes/UserTest.php 2009-09-26 18:39:15 UTC (rev 4739)
@@ -0,0 +1,61 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once '../../../http/classes/class_user.php';
+
+class UserTest extends PHPUnit_Framework_TestCase
+{
+ var $someUser_name = "demo";
+ var $someUser_description = "Demo User zum Testen";
+
+ public function testCreate()
+ {
+ $user = new User(null);
+ $user->name = $this->someUser_name;
+ $user->description = $this->someUser_description;
+ $user->public = 1;
+
+
+ $this->assertNotNull($user);
+
+ try{
+ $create_result = $user->create();
+ }
+ catch(Exception $E)
+ {
+ $this->assertEquals($E->getMessage(), 'Could not set initial values of new User');
+ }
+ $this->assertNotNull($create_result);
+
+
+ $change_result = $user->change(null);
+ $this->assertTrue($change_result);
+
+ try{
+ $commit_result = $user->commit();
+ }
+ catch(Exception $E)
+ {
+ $this->assertEquals($E->getMessage(), 'Database error updating User');
+ }
+
+ $this->assertTrue($commit_result);
+
+ }
+
+ /*
+ * @depends testCreate
+ */
+ public function testDelete()
+ {
+ $user = User::byName($this->someUser_name);
+ $this->assertNotNull($user);
+
+ $remove_result = $user->remove();
+ $this->assertTrue($remove_result);
+
+ $user = null;
+ $user = User::byName($this->someUser_name);
+ $this->assertNull($user);
+ }
+}
+?>
More information about the Mapbender_commits
mailing list