From 2dfdd589f3d4cd5b995b0d0997549ba0ac0d47af Mon Sep 17 00:00:00 2001 From: nbm Date: Sat, 11 Jun 2005 21:16:03 +0000 Subject: [PATCH] Start getting rid of OBE'd tests - they don't help anyone. --- tests/administration/UnitManager.php | 56 -------------------------------------------------------- tests/administration/groupManTesting.php | 131 ----------------------------------------------------------------------------------------------------------------------------------- tests/administration/userCreate.php | 15 --------------- tests/administration/userManTesting.php | 153 --------------------------------------------------------------------------------------------------------------------------------------------------------- tests/archiving/show-calendar.gif | Bin 200 -> 0 bytes tests/archiving/testCalendar.php | 38 -------------------------------------- tests/archiving/testSuite.php | 120 ------------------------------------------------------------------------------------------------------------------------ tests/authentication/authentication.php | 56 -------------------------------------------------------- tests/authentication/ldap.php | 36 ------------------------------------ tests/email/email.php | 21 --------------------- 10 files changed, 0 insertions(+), 626 deletions(-) delete mode 100644 tests/administration/UnitManager.php delete mode 100644 tests/administration/groupManTesting.php delete mode 100644 tests/administration/userCreate.php delete mode 100644 tests/administration/userManTesting.php delete mode 100644 tests/archiving/show-calendar.gif delete mode 100644 tests/archiving/testCalendar.php delete mode 100644 tests/archiving/testSuite.php delete mode 100644 tests/authentication/authentication.php delete mode 100644 tests/authentication/ldap.php delete mode 100644 tests/email/email.php diff --git a/tests/administration/UnitManager.php b/tests/administration/UnitManager.php deleted file mode 100644 index 17e2ca0..0000000 --- a/tests/administration/UnitManager.php +++ /dev/null @@ -1,56 +0,0 @@ -fileSystemRoot/lib/owl.lib.php"); -require_once("$default->fileSystemRoot/lib/administration/UnitManager.inc"); - -/** - * $Id$ - * - * Unit Tests for lib/administration/UnitManager.inc - * - * Licensed under the GNU GPL. For full terms see the file COPYING. - * - * @version $Revision$ - * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * @package tests.administration - */ - -echo "
";
-// unit tests for UnitManager methods
-
-$um = new UnitManager();
-/*
-$userArray = $um->listLdapUsers($userNameSearch);
-if (!userArray) {
-    echo "ldap user lookup failed!
"; -} else { - print_r($userArray); -} -*/ -// do some transformation of the first entry in the array? -// think maybe just set username = uid - -// setup user details array -$unitID = 1; -//($userDetails['username'], $userDetails['name'], '', $userDetails['email'], $userDetails['mobile'], $userDetails['ldap_dn'])"; -$userDetails = array("username" => "michael", - "name" => "michael joseph", - "email" => "michael@jamwarehouse.com", - "mobile" => "0731418818", - "ldap_dn" => "uid=michael,ou=Alcohol and Drug Abuse,ou=Environment and Development,o=Medical Research Council" - ); - -global $default; - -$result = $um->addUser($unitID, $userDetails); -if (!$result) { - echo "add user failed!
"; - echo "error message=" . $_SESSION["errorMessage"]; -} else { - echo "added user successfully
"; -} - -echo "
"; -?> diff --git a/tests/administration/groupManTesting.php b/tests/administration/groupManTesting.php deleted file mode 100644 index db98377..0000000 --- a/tests/administration/groupManTesting.php +++ /dev/null @@ -1,131 +0,0 @@ - - - -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"); - -?> - - - \ No newline at end of file diff --git a/tests/administration/userCreate.php b/tests/administration/userCreate.php deleted file mode 100644 index 1fbe813..0000000 --- a/tests/administration/userCreate.php +++ /dev/null @@ -1,15 +0,0 @@ -"; - $sql = $default->db; - $sql->query("INSERT INTO users (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id) " . - "VALUES ('admin" . $i . "', 'Administrator', '21232f297a57a5a743894a0e4a801fc3', 0, 0, '', '', 1, 1, '', 10000, 1)"); - $sql->query("INSERT INTO users_groups_link (group_id, user_id) SELECT 1, ID FROM users where username = 'admin" . $i . "'"); -} - - -?> diff --git a/tests/administration/userManTesting.php b/tests/administration/userManTesting.php deleted file mode 100644 index 7876be0..0000000 --- a/tests/administration/userManTesting.php +++ /dev/null @@ -1,153 +0,0 @@ - - - -fileSystemRoot/lib/db.inc"); -require ("$default->fileSystemRoot/lib/dms.inc"); -require ("$default->fileSystemRoot/lib/administration/UserManager.inc"); - -/*-----------------------------------------------------------------*/ -/** - * $Id: UserManTesting.php - - * Tests the user management class - * - * Tests: - createUser() -> if username exists and if username does'nt exist - * - listUsers() - * - removeUser() - * - getUserDetails() -> if user exists and if user does'nt exist - * - getuserID() -> if username exists or doe'snt - * - addusertogroup - * - removeuserfromgroup - - * - * - * @version $Revision$ - * @author Mukhtar Dharsey - * @package tests.administration - */ -/*-----------------------------------------------------------------*/ - - - -$user = new UserManager; - - -/////////////////Test insertions -// Reload page to test if insertions fail due to existance of username -echo "

*** add Users Test ***

"; -$Details = array(); - -$Details['username'] = "stone cold"; -$Details['name'] = "Kurt Angle"; -$Details['password'] = "Idontsuck"; -$Details['quota_max'] = 11; -$Details['quota_current'] = 6; -$Details['email'] = "kurt@illmakeutap.com"; -$Details['mobile'] = 27825328240; -$Details['email_notification'] = 1; -$Details['sms_notification'] = 1; -$Details['ldap_dn'] = 10202020; -$Details['max_sessions'] = 50; -$Details['language'] = $default->defaultLanguage; - -$user->createUser($Details); - -/////////////// Test list users -echo "

*** List Users Test ***

"; -$test=$user->listUsers(); - -for( $i=0;$i < count($test); $i++) - - { - printf("UserName: %s
", $test[$i]['username']); - } - - -/////////////// Test add user to group -echo "

*** Add Users To a Group Test ***

"; -//test add new user to group -$test = $user->addUserToGroup(2,1); -$test = $user->addUserToGroup(2,2); -$test = $user->addUserToGroup(2,3); - -// test user already added -$test = $user->addUserToGroup(3,1); - -/////////////// Test get groups user belongs 2 -echo "

*** Show users groups test ***

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

*** Remove Users from a Group Test ***

"; -$test = $user->removeUserFromGroup(3,1); - -////////////// Test Remove User -echo "

*** Remove User Test ***

"; -$test = $user->removeUser(1); - - -///////////////////// Test updateuser -echo "

*** Update User's Details Test ***

"; -$Details = array(); - -$Details['username'] = "BookerT"; -$Details['name'] = "Goldust"; -$Details['password'] = "suckaTrashing"; -$Details['quota_max'] = 10; -$Details['quota_current'] = 2; -$Details['email'] = "GoldustandBookerT@themovies.com"; -$Details['mobile'] = 0825328240; -$Details['email_notification'] = 1; -$Details['sms_notification'] = 0; - - -// test user not exist -$test = $user->UpdateUser(7, $Details); - -// test user that does exist -$test = $user->UpdateUser(2, $Details); - - -//////////////// Test Get User Details -echo "

*** Get User's Details Test ***

"; -// user does'nt exist -$test = $user->GetUserDetails(10); - -//user does exist -$test = $user->GetUserDetails(2); - -printf("Name: %s
", $test[2]['name']); -printf("UserName: %s
", $test[2]['username']); -printf("Password: %s
", $test[2]['password']); -printf("Quota_Max: %s
", $test[2]['quota_max']); -printf("Quota_current: %s
", $test[2]['quota_current']); -printf("Email: %s
", $test[2]['email']); -printf("Mobile: %s
", $test[2]['mobile']); -printf("Email: %s
", $test[2]['email_notification']); -printf("Sms: %s
", $test[2]['sms_notification']); - - -/////////////// Test get User ID -echo "

*** List Users Test ***

"; - -// user exists -$test = $user->getUserID("stone cold"); - -printf("
ID: %s
", $test); - -// user doe'snt exist -$test = $user->getUserID("Winnie Mandela"); - -?> - - - \ No newline at end of file diff --git a/tests/archiving/show-calendar.gif b/tests/archiving/show-calendar.gif deleted file mode 100644 index 68d10f1..0000000 Binary files a/tests/archiving/show-calendar.gif and /dev/null differ diff --git a/tests/archiving/testCalendar.php b/tests/archiving/testCalendar.php deleted file mode 100644 index 461f098..0000000 --- a/tests/archiving/testCalendar.php +++ /dev/null @@ -1,38 +0,0 @@ -fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); - -function buildPage() { -$str = <<< EOT - -
- - - - -
- -EOT; - return $str; -} -//echo buildPage(); - -if (checkSession()) { - // instantiate my content pattern - $oContent = new PatternCustom(); - $oContent->setHtml(buildPage()); - // build the page - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $main->setCentralPayload($oContent); - $main->setFormAction($_SERVER['PHP_SELF']); - $main->render(); -} - -?> \ No newline at end of file diff --git a/tests/archiving/testSuite.php b/tests/archiving/testSuite.php deleted file mode 100644 index be45b87..0000000 --- a/tests/archiving/testSuite.php +++ /dev/null @@ -1,120 +0,0 @@ -"; - -$aClasses = array("archiving/ArchiveRestorationRequest" => array("DocumentID", "RequestUserID", "AdminUserID", "DateTime"), - "archiving/DocumentArchiving" => array("DocumentID", "ArchivingSettingsID"), - "archiving/TimeUnit" => array("Name"), - "archiving/ArchivingType" => array("Name"), - "archiving/TimePeriod" => array("TimeUnitID", "Units"), - "archiving/ArchivingSettings" => array("ArchivingTypeID", "ExpirationDate", "DocumentTransactionID", "TimePeriodID")); - -$aInitialValues = array("1,2,3", - "1,3", - "hour", - "\"blah's\"", - "1, 10", - "2, \"2005-15-15\", 5, 1"); - -$aSetValues = array(array(4,5,6,"2010-10-10"), - array(9,8,7), - array("minute"), - array("fooblar's"), - array(2,20), - array(3, "2001-02-03", -1, 4)); - - -$count = 0; -$aTestClasses = array("ArchivingSettings"); - -foreach ($aClasses as $classPath => $aMethodList) { - $aClassPath = explode("/", $classPath); - $className = $aClassPath[count($aClassPath)-1]; - if (in_array($className, $aTestClasses)) { - - require_once("$default->fileSystemRoot/lib/$classPath.inc"); - - $constructor = "\$oClass = new $className($aInitialValues[$count]);"; - echo "$className- $constructor
"; - echo "Testing creation
"; - eval($constructor); - if (isset($oClass)) { - echo "Passed creation test

"; - - echo "Testing storage
"; - if ($oClass->create()) { - echo "Passed storage test

"; - //$oClass->iId = -1;$oClass->create(); - - echo "Testing setting and getting of values
"; - $i=0; - foreach ($aMethodList as $method) { - $getter = "get$method"; - $setter = "set$method"; - echo "Current $method: " . $oClass->$getter() . "
"; - echo "Setting $method to: " . $aSetValues[$count][$i] . "
"; - $oClass->$setter($aSetValues[$count][$i]); - echo "New $method: " . $oClass->$getter() . "

"; - $i++; - } - - echo "Testing update
"; - if ($oClass->update()) { - echo "Passed update test

"; - - echo "Testing retrieval
"; - $get = "\$oNewClass = $className::get(1);"; - eval($get); - if ($oNewClass) { - echo "Passed retrieval test:\n" . arrayToString($oNewClass) . "
"; - } else { - echo "Failed retrieval test.
"; - } - - echo "Testing array retrieval
"; - $getList = "\$aNewClass = $className::getList();"; - eval($getList); - echo "array=\n" . arrayToString($aNewClass) . "

"; - - echo "Testing deletion
"; - if ($oClass->delete()) { - echo "Passed deletion test
"; - } else { - echo "Failed deletion test"; - } - } else { - echo "Failed update test
"; - echo "Tests NOT run: (a) retrieval by id (b) array list retrieval (c) deletion
"; - } - } else { - echo "Failed storage test
"; - echo "Tests NOT run: (a) update (b) retrieval by id (c) array list retrieval (d) deletion
"; - } - } else { - echo "Failed creation test
"; - echo "Tests NOT run: (a)getting and setting (b) storage (c) retrieval by id (d) array list retrieval (e) deletion
"; - } - } else { - echo "skipping $className"; - } - $count++; - echo "
"; -} -echo ""; - -?> \ No newline at end of file diff --git a/tests/authentication/authentication.php b/tests/authentication/authentication.php deleted file mode 100644 index 5656516..0000000 --- a/tests/authentication/authentication.php +++ /dev/null @@ -1,56 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package tests.authentication - */ -//if (checkSession()) { - require_once("$default->fileSystemRoot/lib/authentication/DBAuthenticator.inc"); - echo "Testing DB searching"; - // user attributes to search for - $aAttributes = array ("username", "name", "email", "mobile", "email_notification", "sms_notification"); - $oDbAuth = new DBAuthenticator(); - $sSearch = "user"; - echo ""; - - require_once("$default->fileSystemRoot/lib/authentication/LDAPAuthenticator.inc"); - echo "Testing LDAP searching"; - // user attributes to search for - $aAttributes = array ("dn", "uid", "givenname", "sn", "mail", "mobile"); - $oLdapAuth = new LDAPAuthenticator(); - $sSearch = "mi"; - echo ""; - - echo "Testing LDAP authentication"; - // user credentials to authenticate - $sUserName = "michael"; $sPassword = "pass123"; - echo ""; - - $sUserName = "rob"; $sPassword = "rob123"; - echo ""; - - $sUserName = "mukhtar"; $sPassword = "mukhtar123"; - echo ""; -//} -?> diff --git a/tests/authentication/ldap.php b/tests/authentication/ldap.php deleted file mode 100644 index d453c04..0000000 --- a/tests/authentication/ldap.php +++ /dev/null @@ -1,36 +0,0 @@ -"; -$user="michael"; -$password="michael"; -$ldap["domain"]="jamwarehouse.com"; -$ldap["dn"]=$user."@".$ldap["domain"]; //microsoft ldap wants the username@domain for authentication -//$ldap["dn"]="uid=$user, ou=The Jam Warehouse,ou=External to MRC, o=Medical Research Council"; -$ldap["ds"]="192.168.1.8"; //ldap server -if ($ldap["connection"]=ldap_connect($ldap["ds"])) { - if ($ldap["connection"]) { - echo "binding to " . $ldap["dn"]; - //if(@ldap_bind($ldap["connection"],$ldap["dn"],$password)) { - if(@ldap_bind($ldap["connection"])) { - $result = ldap_search( $ldap["connection"], "CN=Users,DC=jamwarehouse,DC=com", "samaccountname=*mi*"); - echo '$result = ldap_search( $ldap["connection"], "CN=Users,DC=jamwarehouse,DC=com", "samaccountname=*mi*");'; - //$result = ldap_search( $ldap["connection"], "o=Medical Research Council", "uid=karen"); - $account="samaccountname=".$user; - //$result = ldap_list($ldap["connection"], "CN=Users,DC=jamwarehouse,DC=com", $account); - $entry = ldap_get_entries($ldap["connection"], $result); - $fullname=$entry[0]["cn"][0]; - $email=$entry[0]["mail"][0]; - $firstname=$entry[0]["givenname"][0]; - $midname=$entry[0]["initials"][0]; - $lastname=$entry[0]["sn"][0]; - - //print_r($entry[0]["samaccountname"]); - print_r($entry); - - //print "
Your name is ".$fullname." and your email is ".$email; - } else { - print ("
Incorrect password or user ".$user." not found.

"); - } - } -} -echo ""; -?> diff --git a/tests/email/email.php b/tests/email/email.php deleted file mode 100644 index ff0c953..0000000 --- a/tests/email/email.php +++ /dev/null @@ -1,21 +0,0 @@ -fileSystemRoot/lib/email/Email.inc"); - //require_once("$default->fileSystemRoot/phpmailer/class.smtp.php"); - require_once("$default->fileSystemRoot/phpmailer/class.phpmailer.php"); - Email::sendHyperLink("ktdev@jamwarehouse.com", "KTDEV", "rob@jamwarehouse.com", "testing email", "We're testing the email
", "http://www.google.com"); -} - -?> -- libgit2 0.21.4