diff --git a/tests/administration/groupManTesting.php b/tests/administration/groupManTesting.php new file mode 100644 index 0000000..7b0f80d --- /dev/null +++ b/tests/administration/groupManTesting.php @@ -0,0 +1,126 @@ + + + + if username exists and if username does'nt exist + * - listUsers() + * - removeUser() + * - getUserDetails() -> if group exists and if group does'nt exist + * - getuserID() -> if username exists or doe'snt + * - addusertogroup + * - removeuserfromgroup + + * + * + * @version $Revision$ + * @author Mukhtar Dharsey + * @package testing + */ +/*-----------------------------------------------------------------*/ + + +require ("./config/dmsDefaults.php"); +//require ("$default->owl_fs_root/lib/db.inc"); +require ("$default->owl_fs_root/lib/dms.inc"); +require ("$default->owl_fs_root/lib/administration/GroupManager.inc"); + +$group = new groupManager; + + +/////////////////Test insertions +// Reload page to test if insertions fail due to existance of username +echo "

*** add new Group Test ***

"; + + +$group->createGroup("SpellCheckers"); +$group->createGroup("Publishers"); +$group->createGroup("Reapers"); +$group->createGroup("Politicians"); + +/////////////// Test list groups +echo "

*** List Groups Test ***

"; +$test=$group->listGroups(); + +for( $i=0;$i < count($test); $i++) + + { + printf("GroupNames: %s
", $test[$i]['name']); + } + + +/////////////// Test add group to unit +echo "

*** Add Group to unit Test ***

"; +//test add new group to group note that 1 group can only belong to 1 unit +$test = $group->addGroupToUnit(2,1); +$test = $group->addGroupToUnit(3,2); +$test = $group->addGroupToUnit(2,3); + + +// test group already added +// test group already added +$test = $group->addGroupToUnit(2,1); + + +/////////////// Test get groups group belongs 2 +echo "

*** Show unit group belongs to test ***

"; +$test = $group->getUnit(2); + +//for($i=0;$i < count($test);$i++) +//{ +printf("unit ID: %s
", $test[1]['id']); +printf("unit Name: %s
", $test[1]['name']); +//} + + +/////////////// Test remove group from unit +echo "

*** Remove group from unit Test ***

"; +$test = $group->removeGroupFromUnit(2,2); + +////////////// Test Remove Group +echo "

*** Remove group Test ***

"; +$test = $group->removeGroup(3); + + +///////////////////// Test updateGroup +echo "

*** Update Group Details/ Rename group Test ***

"; +// test group not exist +$test = $group->updateGroup(4,"baboona"); + +// test group that does exist +$test = $group->UpdateGroup(12, "charl's glass"); + + +//////////////// Test Get Group Name +echo "

*** Get Group Name Test ***

"; +// group does'nt exist +$test = $group->GetGroupName(15); + +//group does exist +$test = $group->GetGroupName(4); + +printf("Name: %s
", $test); + + + +/////////////// Test getGroupID +echo "

*** List GroupID Test ***

"; + +// group exists +$test = $group->getGroupID("System Administrators"); + +printf("
ID: %s
", $test); + +// group doe'snt exist +$test = $group->getGroupID("Winnie Mandela"); + +?> + + + \ No newline at end of file