fileSystemRoot/lib/db.inc"); require ("$default->fileSystemRoot/lib/dms.inc"); require ("$default->fileSystemRoot/lib/administration/GroupManager.inc"); /*-----------------------------------------------------------------*/ /** * $Id: UserManTesting.php * Tests the group management class * * Tests: - createUser() -> 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 tests.administration */ /*-----------------------------------------------------------------*/ $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 unit echo "

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

"; $test = $group->getUnit(2); printf("unit ID: %s
", $test[1]['id']); printf("unit Name: %s
", $test[1]['name']); /////////////// Test get groups group belongs 2 echo "

*** Show org unit belongs to ***

"; $test = $group->getOrg(1); printf("org ID: %s
", $test[1]['id']); printf("org 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 "

*** get GroupID Test ***

"; // group exists $test = $group->getGroupID('System Administrators'); printf("
ID: %s
", $test); // group doe'snt exist $test = $group->getGroupID("Winnie Mandela"); ?>