Commit 2dfdd589f3d4cd5b995b0d0997549ba0ac0d47af
1 parent
ae0aa81c
Start getting rid of OBE'd tests - they don't help anyone.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3349 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
10 changed files
with
0 additions
and
626 deletions
tests/administration/UnitManager.php deleted
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -// main library routines and defaults | ||
| 4 | -require_once("../../config/dmsDefaults.php"); | ||
| 5 | -require_once("$default->fileSystemRoot/lib/owl.lib.php"); | ||
| 6 | -require_once("$default->fileSystemRoot/lib/administration/UnitManager.inc"); | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * $Id$ | ||
| 10 | - * | ||
| 11 | - * Unit Tests for lib/administration/UnitManager.inc | ||
| 12 | - * | ||
| 13 | - * Licensed under the GNU GPL. For full terms see the file COPYING. | ||
| 14 | - * | ||
| 15 | - * @version $Revision$ | ||
| 16 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | ||
| 17 | - * @package tests.administration | ||
| 18 | - */ | ||
| 19 | - | ||
| 20 | -echo "<pre>"; | ||
| 21 | -// unit tests for UnitManager methods | ||
| 22 | - | ||
| 23 | -$um = new UnitManager(); | ||
| 24 | -/* | ||
| 25 | -$userArray = $um->listLdapUsers($userNameSearch); | ||
| 26 | -if (!userArray) { | ||
| 27 | - echo "ldap user lookup failed!<br>"; | ||
| 28 | -} else { | ||
| 29 | - print_r($userArray); | ||
| 30 | -} | ||
| 31 | -*/ | ||
| 32 | -// do some transformation of the first entry in the array? | ||
| 33 | -// think maybe just set username = uid | ||
| 34 | - | ||
| 35 | -// setup user details array | ||
| 36 | -$unitID = 1; | ||
| 37 | -//($userDetails['username'], $userDetails['name'], '', $userDetails['email'], $userDetails['mobile'], $userDetails['ldap_dn'])"; | ||
| 38 | -$userDetails = array("username" => "michael", | ||
| 39 | - "name" => "michael joseph", | ||
| 40 | - "email" => "michael@jamwarehouse.com", | ||
| 41 | - "mobile" => "0731418818", | ||
| 42 | - "ldap_dn" => "uid=michael,ou=Alcohol and Drug Abuse,ou=Environment and Development,o=Medical Research Council" | ||
| 43 | - ); | ||
| 44 | - | ||
| 45 | -global $default; | ||
| 46 | - | ||
| 47 | -$result = $um->addUser($unitID, $userDetails); | ||
| 48 | -if (!$result) { | ||
| 49 | - echo "add user failed!<br>"; | ||
| 50 | - echo "error message=" . $_SESSION["errorMessage"]; | ||
| 51 | -} else { | ||
| 52 | - echo "added user successfully<br>"; | ||
| 53 | -} | ||
| 54 | - | ||
| 55 | -echo "</pre>"; | ||
| 56 | -?> |
tests/administration/groupManTesting.php deleted
| 1 | -<html> | ||
| 2 | -<body> | ||
| 3 | - | ||
| 4 | -<?php | ||
| 5 | - | ||
| 6 | - | ||
| 7 | -require ("./config/dmsDefaults.php"); | ||
| 8 | -//require ("$default->fileSystemRoot/lib/db.inc"); | ||
| 9 | -require ("$default->fileSystemRoot/lib/dms.inc"); | ||
| 10 | -require ("$default->fileSystemRoot/lib/administration/GroupManager.inc"); | ||
| 11 | - | ||
| 12 | -/*-----------------------------------------------------------------*/ | ||
| 13 | -/** | ||
| 14 | - * $Id: UserManTesting.php | ||
| 15 | - | ||
| 16 | - * Tests the group management class | ||
| 17 | - * | ||
| 18 | - * Tests: - createUser() -> if username exists and if username does'nt exist | ||
| 19 | - * - listUsers() | ||
| 20 | - * - removeUser() | ||
| 21 | - * - getUserDetails() -> if group exists and if group does'nt exist | ||
| 22 | - * - getuserID() -> if username exists or doe'snt | ||
| 23 | - * - addusertogroup | ||
| 24 | - * - removeuserfromgroup | ||
| 25 | - | ||
| 26 | - * | ||
| 27 | - * | ||
| 28 | - * @version $Revision$ | ||
| 29 | - * @author Mukhtar Dharsey | ||
| 30 | - * @package tests.administration | ||
| 31 | - */ | ||
| 32 | -/*-----------------------------------------------------------------*/ | ||
| 33 | - | ||
| 34 | - | ||
| 35 | -$group = new groupManager; | ||
| 36 | - | ||
| 37 | - | ||
| 38 | -/////////////////Test insertions | ||
| 39 | -// Reload page to test if insertions fail due to existance of username | ||
| 40 | -echo "<br><br>*** add new Group Test ***<br><br>"; | ||
| 41 | - | ||
| 42 | - | ||
| 43 | -$group->createGroup("SpellCheckers"); | ||
| 44 | -$group->createGroup("Publishers"); | ||
| 45 | -$group->createGroup("Reapers"); | ||
| 46 | -$group->createGroup("Politicians"); | ||
| 47 | - | ||
| 48 | -/////////////// Test list groups | ||
| 49 | -echo "<br><br>*** List Groups Test ***<br><br>"; | ||
| 50 | -$test=$group->listGroups(); | ||
| 51 | - | ||
| 52 | -for( $i=0;$i < count($test); $i++) | ||
| 53 | - | ||
| 54 | - { | ||
| 55 | - printf("GroupNames: %s<br>", $test[$i]['name']); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - | ||
| 59 | -/////////////// Test add group to unit | ||
| 60 | -echo "<br><br>*** Add Group to unit Test ***<br><br>"; | ||
| 61 | -//test add new group to group note that 1 group can only belong to 1 unit | ||
| 62 | -$test = $group->addGroupToUnit(2,1); | ||
| 63 | -$test = $group->addGroupToUnit(3,2); | ||
| 64 | -$test = $group->addGroupToUnit(2,3); | ||
| 65 | - | ||
| 66 | - | ||
| 67 | -// test group already added | ||
| 68 | -// test group already added | ||
| 69 | -$test = $group->addGroupToUnit(2,1); | ||
| 70 | - | ||
| 71 | - | ||
| 72 | -/////////////// Test get unit | ||
| 73 | -echo "<br><br>*** Show unit group belongs to test ***<br><br>"; | ||
| 74 | -$test = $group->getUnit(2); | ||
| 75 | - | ||
| 76 | -printf("unit ID: %s<br>", $test[1]['id']); | ||
| 77 | -printf("unit Name: %s<br>", $test[1]['name']); | ||
| 78 | - | ||
| 79 | - | ||
| 80 | -/////////////// Test get groups group belongs 2 | ||
| 81 | -echo "<br><br>*** Show org unit belongs to ***<br><br>"; | ||
| 82 | -$test = $group->getOrg(1); | ||
| 83 | - | ||
| 84 | -printf("org ID: %s<br>", $test[1]['id']); | ||
| 85 | -printf("org Name: %s<br>", $test[1]['name']); | ||
| 86 | - | ||
| 87 | -/////////////// Test remove group from unit | ||
| 88 | -echo "<br><br>*** Remove group from unit Test ***<br><br>"; | ||
| 89 | -$test = $group->removeGroupFromUnit(2,2); | ||
| 90 | - | ||
| 91 | -////////////// Test Remove Group | ||
| 92 | -echo "<br><br>*** Remove group Test ***<br><br>"; | ||
| 93 | -$test = $group->removeGroup(3); | ||
| 94 | - | ||
| 95 | - | ||
| 96 | -///////////////////// Test updateGroup | ||
| 97 | -echo "<br><br>*** Update Group Details/ Rename group Test ***<br><br>"; | ||
| 98 | -// test group not exist | ||
| 99 | -$test = $group->updateGroup(4,"baboona"); | ||
| 100 | - | ||
| 101 | -// test group that does exist | ||
| 102 | -$test = $group->UpdateGroup(12, "charl's glass"); | ||
| 103 | - | ||
| 104 | - | ||
| 105 | -//////////////// Test Get Group Name | ||
| 106 | -echo "<br><br>*** Get Group Name Test ***<br><br>"; | ||
| 107 | -// group does'nt exist | ||
| 108 | -$test = $group->GetGroupName(15); | ||
| 109 | - | ||
| 110 | -//group does exist | ||
| 111 | -$test = $group->GetGroupName(4); | ||
| 112 | - | ||
| 113 | -printf("Name: %s<br>", $test); | ||
| 114 | - | ||
| 115 | - | ||
| 116 | - | ||
| 117 | -/////////////// Test getGroupID | ||
| 118 | -echo "<br><br>*** get GroupID Test ***<br><br>"; | ||
| 119 | - | ||
| 120 | -// group exists | ||
| 121 | -$test = $group->getGroupID('System Administrators'); | ||
| 122 | - | ||
| 123 | -printf("<br>ID: %s<br>", $test); | ||
| 124 | - | ||
| 125 | -// group doe'snt exist | ||
| 126 | -$test = $group->getGroupID("Winnie Mandela"); | ||
| 127 | - | ||
| 128 | -?> | ||
| 129 | - | ||
| 130 | -</HTML> | ||
| 131 | -</BODY> | ||
| 132 | \ No newline at end of file | 0 | \ No newline at end of file |
tests/administration/userCreate.php deleted
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -require_once("./config/dmsDefaults.php"); | ||
| 4 | - | ||
| 5 | -// write to file | ||
| 6 | -for ($i = 0; $i < 1000; $i++) { | ||
| 7 | - echo "Done $i <br>"; | ||
| 8 | - $sql = $default->db; | ||
| 9 | - $sql->query("INSERT INTO users (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id) " . | ||
| 10 | - "VALUES ('admin" . $i . "', 'Administrator', '21232f297a57a5a743894a0e4a801fc3', 0, 0, '', '', 1, 1, '', 10000, 1)"); | ||
| 11 | - $sql->query("INSERT INTO users_groups_link (group_id, user_id) SELECT 1, ID FROM users where username = 'admin" . $i . "'"); | ||
| 12 | -} | ||
| 13 | - | ||
| 14 | - | ||
| 15 | -?> |
tests/administration/userManTesting.php deleted
| 1 | -<html> | ||
| 2 | -<body> | ||
| 3 | - | ||
| 4 | -<?php | ||
| 5 | - | ||
| 6 | -require ("./config/dmsDefaults.php"); | ||
| 7 | -//require ("$default->fileSystemRoot/lib/db.inc"); | ||
| 8 | -require ("$default->fileSystemRoot/lib/dms.inc"); | ||
| 9 | -require ("$default->fileSystemRoot/lib/administration/UserManager.inc"); | ||
| 10 | - | ||
| 11 | -/*-----------------------------------------------------------------*/ | ||
| 12 | -/** | ||
| 13 | - * $Id: UserManTesting.php | ||
| 14 | - | ||
| 15 | - * Tests the user management class | ||
| 16 | - * | ||
| 17 | - * Tests: - createUser() -> if username exists and if username does'nt exist | ||
| 18 | - * - listUsers() | ||
| 19 | - * - removeUser() | ||
| 20 | - * - getUserDetails() -> if user exists and if user does'nt exist | ||
| 21 | - * - getuserID() -> if username exists or doe'snt | ||
| 22 | - * - addusertogroup | ||
| 23 | - * - removeuserfromgroup | ||
| 24 | - | ||
| 25 | - * | ||
| 26 | - * | ||
| 27 | - * @version $Revision$ | ||
| 28 | - * @author Mukhtar Dharsey | ||
| 29 | - * @package tests.administration | ||
| 30 | - */ | ||
| 31 | -/*-----------------------------------------------------------------*/ | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 35 | -$user = new UserManager; | ||
| 36 | - | ||
| 37 | - | ||
| 38 | -/////////////////Test insertions | ||
| 39 | -// Reload page to test if insertions fail due to existance of username | ||
| 40 | -echo "<br><br>*** add Users Test ***<br><br>"; | ||
| 41 | -$Details = array(); | ||
| 42 | - | ||
| 43 | -$Details['username'] = "stone cold"; | ||
| 44 | -$Details['name'] = "Kurt Angle"; | ||
| 45 | -$Details['password'] = "Idontsuck"; | ||
| 46 | -$Details['quota_max'] = 11; | ||
| 47 | -$Details['quota_current'] = 6; | ||
| 48 | -$Details['email'] = "kurt@illmakeutap.com"; | ||
| 49 | -$Details['mobile'] = 27825328240; | ||
| 50 | -$Details['email_notification'] = 1; | ||
| 51 | -$Details['sms_notification'] = 1; | ||
| 52 | -$Details['ldap_dn'] = 10202020; | ||
| 53 | -$Details['max_sessions'] = 50; | ||
| 54 | -$Details['language'] = $default->defaultLanguage; | ||
| 55 | - | ||
| 56 | -$user->createUser($Details); | ||
| 57 | - | ||
| 58 | -/////////////// Test list users | ||
| 59 | -echo "<br><br>*** List Users Test ***<br><br>"; | ||
| 60 | -$test=$user->listUsers(); | ||
| 61 | - | ||
| 62 | -for( $i=0;$i < count($test); $i++) | ||
| 63 | - | ||
| 64 | - { | ||
| 65 | - printf("UserName: %s<br>", $test[$i]['username']); | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - | ||
| 69 | -/////////////// Test add user to group | ||
| 70 | -echo "<br><br>*** Add Users To a Group Test ***<br><br>"; | ||
| 71 | -//test add new user to group | ||
| 72 | -$test = $user->addUserToGroup(2,1); | ||
| 73 | -$test = $user->addUserToGroup(2,2); | ||
| 74 | -$test = $user->addUserToGroup(2,3); | ||
| 75 | - | ||
| 76 | -// test user already added | ||
| 77 | -$test = $user->addUserToGroup(3,1); | ||
| 78 | - | ||
| 79 | -/////////////// Test get groups user belongs 2 | ||
| 80 | -echo "<br><br>*** Show users groups test ***<br><br>"; | ||
| 81 | -$test = $user->getGroups(2); | ||
| 82 | - | ||
| 83 | -for( $i=1;$i < count($test); $i++) | ||
| 84 | -{ | ||
| 85 | -printf("Group ID: %s<br>", $test[$i]['id']); | ||
| 86 | -printf("Group Name: %s<br>", $test[$i]['name']); | ||
| 87 | -} | ||
| 88 | - | ||
| 89 | -/////////////// Test remove user from group | ||
| 90 | -echo "<br><br>*** Remove Users from a Group Test ***<br><br>"; | ||
| 91 | -$test = $user->removeUserFromGroup(3,1); | ||
| 92 | - | ||
| 93 | -////////////// Test Remove User | ||
| 94 | -echo "<br><br>*** Remove User Test ***<br><br>"; | ||
| 95 | -$test = $user->removeUser(1); | ||
| 96 | - | ||
| 97 | - | ||
| 98 | -///////////////////// Test updateuser | ||
| 99 | -echo "<br><br>*** Update User's Details Test ***<br><br>"; | ||
| 100 | -$Details = array(); | ||
| 101 | - | ||
| 102 | -$Details['username'] = "BookerT"; | ||
| 103 | -$Details['name'] = "Goldust"; | ||
| 104 | -$Details['password'] = "suckaTrashing"; | ||
| 105 | -$Details['quota_max'] = 10; | ||
| 106 | -$Details['quota_current'] = 2; | ||
| 107 | -$Details['email'] = "GoldustandBookerT@themovies.com"; | ||
| 108 | -$Details['mobile'] = 0825328240; | ||
| 109 | -$Details['email_notification'] = 1; | ||
| 110 | -$Details['sms_notification'] = 0; | ||
| 111 | - | ||
| 112 | - | ||
| 113 | -// test user not exist | ||
| 114 | -$test = $user->UpdateUser(7, $Details); | ||
| 115 | - | ||
| 116 | -// test user that does exist | ||
| 117 | -$test = $user->UpdateUser(2, $Details); | ||
| 118 | - | ||
| 119 | - | ||
| 120 | -//////////////// Test Get User Details | ||
| 121 | -echo "<br><br>*** Get User's Details Test ***<br><br>"; | ||
| 122 | -// user does'nt exist | ||
| 123 | -$test = $user->GetUserDetails(10); | ||
| 124 | - | ||
| 125 | -//user does exist | ||
| 126 | -$test = $user->GetUserDetails(2); | ||
| 127 | - | ||
| 128 | -printf("Name: %s<br>", $test[2]['name']); | ||
| 129 | -printf("UserName: %s<br>", $test[2]['username']); | ||
| 130 | -printf("Password: %s<br>", $test[2]['password']); | ||
| 131 | -printf("Quota_Max: %s<br>", $test[2]['quota_max']); | ||
| 132 | -printf("Quota_current: %s<br>", $test[2]['quota_current']); | ||
| 133 | -printf("Email: %s<br>", $test[2]['email']); | ||
| 134 | -printf("Mobile: %s<br>", $test[2]['mobile']); | ||
| 135 | -printf("Email: %s <br>", $test[2]['email_notification']); | ||
| 136 | -printf("Sms: %s<br>", $test[2]['sms_notification']); | ||
| 137 | - | ||
| 138 | - | ||
| 139 | -/////////////// Test get User ID | ||
| 140 | -echo "<br><br>*** List Users Test ***<br><br>"; | ||
| 141 | - | ||
| 142 | -// user exists | ||
| 143 | -$test = $user->getUserID("stone cold"); | ||
| 144 | - | ||
| 145 | -printf("<br>ID: %s<br>", $test); | ||
| 146 | - | ||
| 147 | -// user doe'snt exist | ||
| 148 | -$test = $user->getUserID("Winnie Mandela"); | ||
| 149 | - | ||
| 150 | -?> | ||
| 151 | - | ||
| 152 | -</HTML> | ||
| 153 | -</BODY> | ||
| 154 | \ No newline at end of file | 0 | \ No newline at end of file |
tests/archiving/show-calendar.gif deleted
200 Bytes
tests/archiving/testCalendar.php deleted
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -require_once("../../config/dmsDefaults.php"); | ||
| 4 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); | ||
| 5 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 6 | - | ||
| 7 | -function buildPage() { | ||
| 8 | -$str = <<< EOT | ||
| 9 | -<!-- <html> | ||
| 10 | -<head> | ||
| 11 | -<script language="JavaScript" src="datePicker.js"></script> | ||
| 12 | -</head> | ||
| 13 | -<BODY> --> | ||
| 14 | -<center> | ||
| 15 | -<input type=text name="datebox" size=15> | ||
| 16 | -<!-- <a href="javascript:show_calendar('MainForm.datebox',null,null,'YYYY-MM-DD');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"> --> | ||
| 17 | -<a href="javascript:show_calendar('MainForm.datebox');"> | ||
| 18 | -<img src="show-calendar.gif" width=24 height=22 border=0></a> | ||
| 19 | -</center> | ||
| 20 | -<!--</body> | ||
| 21 | -</html>--> | ||
| 22 | -EOT; | ||
| 23 | - return $str; | ||
| 24 | -} | ||
| 25 | -//echo buildPage(); | ||
| 26 | - | ||
| 27 | -if (checkSession()) { | ||
| 28 | - // instantiate my content pattern | ||
| 29 | - $oContent = new PatternCustom(); | ||
| 30 | - $oContent->setHtml(buildPage()); | ||
| 31 | - // build the page | ||
| 32 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 33 | - $main->setCentralPayload($oContent); | ||
| 34 | - $main->setFormAction($_SERVER['PHP_SELF']); | ||
| 35 | - $main->render(); | ||
| 36 | -} | ||
| 37 | - | ||
| 38 | -?> | ||
| 39 | \ No newline at end of file | 0 | \ No newline at end of file |
tests/archiving/testSuite.php deleted
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * Contains unit tests for all classes | ||
| 4 | - * | ||
| 5 | - * Tests are: | ||
| 6 | - * o creation of object | ||
| 7 | - * o setting/getting of values | ||
| 8 | - * o storing of object | ||
| 9 | - * o retrieval of object by primary key | ||
| 10 | - * o retrieval of an array of objects | ||
| 11 | - * o updating of object | ||
| 12 | - * o deletion of object | ||
| 13 | - * @package tests.archiving | ||
| 14 | - */ | ||
| 15 | - | ||
| 16 | -require_once("../../config/dmsDefaults.php"); | ||
| 17 | - | ||
| 18 | -echo "<pre>"; | ||
| 19 | - | ||
| 20 | -$aClasses = array("archiving/ArchiveRestorationRequest" => array("DocumentID", "RequestUserID", "AdminUserID", "DateTime"), | ||
| 21 | - "archiving/DocumentArchiving" => array("DocumentID", "ArchivingSettingsID"), | ||
| 22 | - "archiving/TimeUnit" => array("Name"), | ||
| 23 | - "archiving/ArchivingType" => array("Name"), | ||
| 24 | - "archiving/TimePeriod" => array("TimeUnitID", "Units"), | ||
| 25 | - "archiving/ArchivingSettings" => array("ArchivingTypeID", "ExpirationDate", "DocumentTransactionID", "TimePeriodID")); | ||
| 26 | - | ||
| 27 | -$aInitialValues = array("1,2,3", | ||
| 28 | - "1,3", | ||
| 29 | - "hour", | ||
| 30 | - "\"blah's\"", | ||
| 31 | - "1, 10", | ||
| 32 | - "2, \"2005-15-15\", 5, 1"); | ||
| 33 | - | ||
| 34 | -$aSetValues = array(array(4,5,6,"2010-10-10"), | ||
| 35 | - array(9,8,7), | ||
| 36 | - array("minute"), | ||
| 37 | - array("fooblar's"), | ||
| 38 | - array(2,20), | ||
| 39 | - array(3, "2001-02-03", -1, 4)); | ||
| 40 | - | ||
| 41 | - | ||
| 42 | -$count = 0; | ||
| 43 | -$aTestClasses = array("ArchivingSettings"); | ||
| 44 | - | ||
| 45 | -foreach ($aClasses as $classPath => $aMethodList) { | ||
| 46 | - $aClassPath = explode("/", $classPath); | ||
| 47 | - $className = $aClassPath[count($aClassPath)-1]; | ||
| 48 | - if (in_array($className, $aTestClasses)) { | ||
| 49 | - | ||
| 50 | - require_once("$default->fileSystemRoot/lib/$classPath.inc"); | ||
| 51 | - | ||
| 52 | - $constructor = "\$oClass = new $className($aInitialValues[$count]);"; | ||
| 53 | - echo "<b>$className- $constructor</b><br>"; | ||
| 54 | - echo "<b>Testing creation</b><br>"; | ||
| 55 | - eval($constructor); | ||
| 56 | - if (isset($oClass)) { | ||
| 57 | - echo "Passed creation test<br><br>"; | ||
| 58 | - | ||
| 59 | - echo "<b>Testing storage</b><br>"; | ||
| 60 | - if ($oClass->create()) { | ||
| 61 | - echo "Passed storage test<br><br>"; | ||
| 62 | - //$oClass->iId = -1;$oClass->create(); | ||
| 63 | - | ||
| 64 | - echo "<b>Testing setting and getting of values</b><br>"; | ||
| 65 | - $i=0; | ||
| 66 | - foreach ($aMethodList as $method) { | ||
| 67 | - $getter = "get$method"; | ||
| 68 | - $setter = "set$method"; | ||
| 69 | - echo "Current $method: " . $oClass->$getter() . "<br>"; | ||
| 70 | - echo "Setting $method to: " . $aSetValues[$count][$i] . "<br>"; | ||
| 71 | - $oClass->$setter($aSetValues[$count][$i]); | ||
| 72 | - echo "New $method: " . $oClass->$getter() . "<br><br>"; | ||
| 73 | - $i++; | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - echo "<b>Testing update</b><br>"; | ||
| 77 | - if ($oClass->update()) { | ||
| 78 | - echo "Passed update test<br><br>"; | ||
| 79 | - | ||
| 80 | - echo "<b>Testing retrieval</b><br>"; | ||
| 81 | - $get = "\$oNewClass = $className::get(1);"; | ||
| 82 | - eval($get); | ||
| 83 | - if ($oNewClass) { | ||
| 84 | - echo "Passed retrieval test:\n" . arrayToString($oNewClass) . "<br>"; | ||
| 85 | - } else { | ||
| 86 | - echo "Failed retrieval test.<br>"; | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - echo "<b>Testing array retrieval</b><br>"; | ||
| 90 | - $getList = "\$aNewClass = $className::getList();"; | ||
| 91 | - eval($getList); | ||
| 92 | - echo "array=\n" . arrayToString($aNewClass) . "<br><br>"; | ||
| 93 | - | ||
| 94 | - echo "<b>Testing deletion</b><br>"; | ||
| 95 | - if ($oClass->delete()) { | ||
| 96 | - echo "Passed deletion test<br>"; | ||
| 97 | - } else { | ||
| 98 | - echo "Failed deletion test"; | ||
| 99 | - } | ||
| 100 | - } else { | ||
| 101 | - echo "Failed update test<br>"; | ||
| 102 | - echo "Tests NOT run: (a) retrieval by id (b) array list retrieval (c) deletion<br>"; | ||
| 103 | - } | ||
| 104 | - } else { | ||
| 105 | - echo "Failed storage test<br>"; | ||
| 106 | - echo "Tests NOT run: (a) update (b) retrieval by id (c) array list retrieval (d) deletion<br>"; | ||
| 107 | - } | ||
| 108 | - } else { | ||
| 109 | - echo "Failed creation test<br>"; | ||
| 110 | - echo "Tests NOT run: (a)getting and setting (b) storage (c) retrieval by id (d) array list retrieval (e) deletion<br>"; | ||
| 111 | - } | ||
| 112 | - } else { | ||
| 113 | - echo "skipping $className"; | ||
| 114 | - } | ||
| 115 | - $count++; | ||
| 116 | - echo "<hr>"; | ||
| 117 | -} | ||
| 118 | -echo "</pre>"; | ||
| 119 | - | ||
| 120 | -?> | ||
| 121 | \ No newline at end of file | 0 | \ No newline at end of file |
tests/authentication/authentication.php deleted
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -require_once("../../config/dmsDefaults.php"); | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * $Id$ | ||
| 7 | - * | ||
| 8 | - * Contains unit test code for authentication classes: lib/authentication | ||
| 9 | - * | ||
| 10 | - * Tests are: | ||
| 11 | - * - creation of document subscription object | ||
| 12 | - * - setting/getting of values | ||
| 13 | - * - storing of object | ||
| 14 | - * - updating of object | ||
| 15 | - * - deletion of object | ||
| 16 | - * | ||
| 17 | - * Licensed under the GNU GPL. For full terms see the file COPYING. | ||
| 18 | - * | ||
| 19 | - * @version $Revision$ | ||
| 20 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | ||
| 21 | - * @package tests.authentication | ||
| 22 | - */ | ||
| 23 | -//if (checkSession()) { | ||
| 24 | - require_once("$default->fileSystemRoot/lib/authentication/DBAuthenticator.inc"); | ||
| 25 | - echo "<b>Testing DB searching</b>"; | ||
| 26 | - // user attributes to search for | ||
| 27 | - $aAttributes = array ("username", "name", "email", "mobile", "email_notification", "sms_notification"); | ||
| 28 | - $oDbAuth = new DBAuthenticator(); | ||
| 29 | - $sSearch = "user"; | ||
| 30 | - echo "<ul><li>searching for $sSearch with attributes=<pre>" . arrayToString($aAttributes) . "</pre></li>"; | ||
| 31 | - $aResults = $oDbAuth->searchUsers($sSearch, $aAttributes); | ||
| 32 | - echo "<li><pre>" . arrayToString($aResults) . "</pre></li></ul>"; | ||
| 33 | - | ||
| 34 | - require_once("$default->fileSystemRoot/lib/authentication/LDAPAuthenticator.inc"); | ||
| 35 | - echo "<b>Testing LDAP searching</b>"; | ||
| 36 | - // user attributes to search for | ||
| 37 | - $aAttributes = array ("dn", "uid", "givenname", "sn", "mail", "mobile"); | ||
| 38 | - $oLdapAuth = new LDAPAuthenticator(); | ||
| 39 | - $sSearch = "mi"; | ||
| 40 | - echo "<ul><li>searching for $sSearch with attributes=<pre>" . arrayToSTring($aAttributes) . "</pre></li>"; | ||
| 41 | - $aResults = $oLdapAuth->searchUsers($sSearch, $aAttributes); | ||
| 42 | - echo "<li><pre>first result=" . arrayToString($aResults[0]) . "</pre></li>"; | ||
| 43 | - echo "<li><pre>" . arrayToString($aResults) . "</pre></li></ul>"; | ||
| 44 | - | ||
| 45 | - echo "<b>Testing LDAP authentication</b>"; | ||
| 46 | - // user credentials to authenticate | ||
| 47 | - $sUserName = "michael"; $sPassword = "pass123"; | ||
| 48 | - echo "<ul><li>Authenticating ($sUserName, $sPassword) : " . ($oLdapAuth->checkPassword($sUserName, $sPassword) ? "true" : "false") . "</li></ul>"; | ||
| 49 | - | ||
| 50 | - $sUserName = "rob"; $sPassword = "rob123"; | ||
| 51 | - echo "<ul><li>Authenticating ($sUserName, $sPassword) : " . ($oLdapAuth->checkPassword($sUserName, $sPassword) ? "true" : "false") . "</li></ul>"; | ||
| 52 | - | ||
| 53 | - $sUserName = "mukhtar"; $sPassword = "mukhtar123"; | ||
| 54 | - echo "<ul><li>Authenticating ($sUserName, $sPassword) : " . ($oLdapAuth->checkPassword($sUserName, $sPassword) ? "true" : "false") . "</li></ul>"; | ||
| 55 | -//} | ||
| 56 | -?> |
tests/authentication/ldap.php deleted
| 1 | -<?php | ||
| 2 | -echo "<pre>"; | ||
| 3 | -$user="michael"; | ||
| 4 | -$password="michael"; | ||
| 5 | -$ldap["domain"]="jamwarehouse.com"; | ||
| 6 | -$ldap["dn"]=$user."@".$ldap["domain"]; //microsoft ldap wants the username@domain for authentication | ||
| 7 | -//$ldap["dn"]="uid=$user, ou=The Jam Warehouse,ou=External to MRC, o=Medical Research Council"; | ||
| 8 | -$ldap["ds"]="192.168.1.8"; //ldap server | ||
| 9 | -if ($ldap["connection"]=ldap_connect($ldap["ds"])) { | ||
| 10 | - if ($ldap["connection"]) { | ||
| 11 | - echo "binding to " . $ldap["dn"]; | ||
| 12 | - //if(@ldap_bind($ldap["connection"],$ldap["dn"],$password)) { | ||
| 13 | - if(@ldap_bind($ldap["connection"])) { | ||
| 14 | - $result = ldap_search( $ldap["connection"], "CN=Users,DC=jamwarehouse,DC=com", "samaccountname=*mi*"); | ||
| 15 | - echo '$result = ldap_search( $ldap["connection"], "CN=Users,DC=jamwarehouse,DC=com", "samaccountname=*mi*");'; | ||
| 16 | - //$result = ldap_search( $ldap["connection"], "o=Medical Research Council", "uid=karen"); | ||
| 17 | - $account="samaccountname=".$user; | ||
| 18 | - //$result = ldap_list($ldap["connection"], "CN=Users,DC=jamwarehouse,DC=com", $account); | ||
| 19 | - $entry = ldap_get_entries($ldap["connection"], $result); | ||
| 20 | - $fullname=$entry[0]["cn"][0]; | ||
| 21 | - $email=$entry[0]["mail"][0]; | ||
| 22 | - $firstname=$entry[0]["givenname"][0]; | ||
| 23 | - $midname=$entry[0]["initials"][0]; | ||
| 24 | - $lastname=$entry[0]["sn"][0]; | ||
| 25 | - | ||
| 26 | - //print_r($entry[0]["samaccountname"]); | ||
| 27 | - print_r($entry); | ||
| 28 | - | ||
| 29 | - //print "<BR>Your name is ".$fullname." and your email is ".$email; | ||
| 30 | - } else { | ||
| 31 | - print ("<BR><B>Incorrect password or user ".$user." not found.</B><P>"); | ||
| 32 | - } | ||
| 33 | - } | ||
| 34 | -} | ||
| 35 | -echo "</pre>"; | ||
| 36 | -?> |
tests/email/email.php deleted
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -require_once("../../config/dmsDefaults.php"); | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | -* Unit tests for static function in Email class in /lib/email/Email.inc | ||
| 7 | -* | ||
| 8 | -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 9 | -* @date 19 January 2003 | ||
| 10 | -* @package tests.email | ||
| 11 | -*/ | ||
| 12 | - | ||
| 13 | - | ||
| 14 | -if (checkSession) { | ||
| 15 | - require_once("$default->fileSystemRoot/lib/email/Email.inc"); | ||
| 16 | - //require_once("$default->fileSystemRoot/phpmailer/class.smtp.php"); | ||
| 17 | - require_once("$default->fileSystemRoot/phpmailer/class.phpmailer.php"); | ||
| 18 | - Email::sendHyperLink("ktdev@jamwarehouse.com", "KTDEV", "rob@jamwarehouse.com", "testing email", "<b>We're testing the email</b><br>", "http://www.google.com"); | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -?> |