diff --git a/tests/archiving/show-calendar.gif b/tests/archiving/show-calendar.gif new file mode 100644 index 0000000..68d10f1 --- /dev/null +++ b/tests/archiving/show-calendar.gif diff --git a/tests/archiving/testSuite.php b/tests/archiving/testSuite.php index ff78199..be45b87 100644 --- a/tests/archiving/testSuite.php +++ b/tests/archiving/testSuite.php @@ -18,95 +18,99 @@ require_once("../../config/dmsDefaults.php"); echo "
";
$aClasses = array("archiving/ArchiveRestorationRequest" => array("DocumentID", "RequestUserID", "AdminUserID", "DateTime"),
- "archiving/DocumentArchiving" => array("DocumentID", "ArchivingTypeID", "ArchivingSettingsID"),
+ "archiving/DocumentArchiving" => array("DocumentID", "ArchivingSettingsID"),
"archiving/TimeUnit" => array("Name"),
"archiving/ArchivingType" => array("Name"),
- "archiving/ArchivingUtilisationSettings" => array("DocumentTransactionID", "TimePeriodID"),
"archiving/TimePeriod" => array("TimeUnitID", "Units"),
- "archiving/ArchivingDateSettings" => array("ExpirationDate", "TimePeriodID"));
+ "archiving/ArchivingSettings" => array("ArchivingTypeID", "ExpirationDate", "DocumentTransactionID", "TimePeriodID"));
$aInitialValues = array("1,2,3",
- "1,2,3",
+ "1,3",
"hour",
"\"blah's\"",
- "5, 1",
"1, 10",
- "'2002-10-10', 1");
+ "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(6,6),
array(2,20),
- array("2003-01-01", 4));
+ array(3, "2001-02-03", -1, 4));
-$count = 0;
+$count = 0;
+$aTestClasses = array("ArchivingSettings");
+
foreach ($aClasses as $classPath => $aMethodList) {
$aClassPath = explode("/", $classPath);
$className = $aClassPath[count($aClassPath)-1];
- 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.
";
+ 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 array retrieval
";
- $getList = "\$aNewClass = $className::getList();";
- eval($getList);
- echo "array=\n" . arrayToString($aNewClass) . "
";
-
- echo "Testing deletion
";
- if ($oClass->delete()) {
- echo "Passed deletion test
";
+ echo "Testing deletion
";
+ if ($oClass->delete()) {
+ echo "Passed deletion test
";
+ } else {
+ echo "Failed deletion test";
+ }
} else {
- echo "Failed deletion test";
- }
+ echo "Failed update test
";
+ echo "Tests NOT run: (a) retrieval by id (b) array list retrieval (c) deletion
";
+ }
} else {
- echo "Failed update test
";
- echo "Tests NOT run: (a) retrieval by id (b) array list retrieval (c) deletion
";
- }
+ echo "Failed storage test
";
+ echo "Tests NOT run: (a) update (b) retrieval by id (c) array list retrieval (d) deletion
";
+ }
} else {
- echo "Failed storage test
";
- echo "Tests NOT run: (a) update (b) retrieval by id (c) array list retrieval (d) deletion
";
+ 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 "Failed creation test
";
- echo "Tests NOT run: (a)getting and setting (b) storage (c) retrieval by id (d) array list retrieval (e) deletion
";
+ echo "skipping $className";
}
$count++;
echo "
";
diff --git a/tests/authentication/ldap.php b/tests/authentication/ldap.php
new file mode 100644
index 0000000..05409da
--- /dev/null
+++ b/tests/authentication/ldap.php
@@ -0,0 +1,44 @@
+";
+$user="michael";
+$password="psychOPomPous03";
+//$password="michael";
+$ldap["domain"]="jamwarehouse.com";
+$ldap["dn"]=$user."@".$ldap["domain"]; //microsoft ldap wants the username@domai
+n for authentication
+//$ldap["dn"]="uid=$user, ou=The Jam Warehouse,ou=External to MRC, o=Medical Res
+earch 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=jamwarehous
+e,DC=com", "samaccountname=*mi*");
+ echo '$result = ldap_search( $ldap["connection"], "CN=Users,DC=jamwa
+rehouse,DC=com", "samaccountname=*mi*");';
+ //$result = ldap_search( $ldap["connection"], "o=Medical Research Co
+uncil", "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 "
";
+?>
\ No newline at end of file
diff --git a/tests/documentmanagement/DocumentBrowser.php b/tests/documentmanagement/DocumentBrowser.php
deleted file mode 100644
index 6c28f22..0000000
--- a/tests/documentmanagement/DocumentBrowser.php
+++ /dev/null
@@ -1,96 +0,0 @@
-fileSystemRoot/lib/documentmanagement/DocumentBrowser.inc");
-
-/**
- * $Id$
- *
- * Unit Tests for lib/documentmanagement/DocumentBrowser.inc
- * includes tests for:
- * browseByFolder($folderID)
- * browseByCategory($category)
- * browseByDocumentType($documentTypeID)
- *
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
- * @version $Revision$
- * @author Michael Joseph "; - $db = new DocumentBrowser(); - - // default browse- should resolve to root folder - echo "default browse- starts at this users root folder"; -} else { - // FIXME: redirect to no permission page - print "you do not have access to view this page! please go away, and come back when you do.
"; - $artifacts = $db->browseByFolder(); - if (!is_null($_SESSION["errorMessage"])) { - echo "error: " . $_SESSION["errorMessage"] . "
"; - $_SESSION["errorMessage"] = NULL; - } - print_r($artifacts); - - // now supply a folderid - $folderID = 3; - echo "browse- starting at folder (folderID=$folderID)
"; - $artifacts = $db->browseByFolder($folderID); - if (!is_null($_SESSION["errorMessage"])) { - echo "error: " . $_SESSION["errorMessage"] . "
"; - $_SESSION["errorMessage"] = NULL; - } - print_r($artifacts); - - // browse by category - echo "category browse- return a list of categories:
"; - $results = $db->browseByCategory(); - if (!is_null($_SESSION["errorMessage"])) { - echo "error: " . $_SESSION["errorMessage"] . "
"; - $_SESSION["errorMessage"] = NULL; - } - print_r($results); - - // pick the first category - $category = $results["categories"][0]; - echo "browsing by category = $category
"; - $artifacts = $db->browseByCategory($category); - if (!is_null($_SESSION["errorMessage"])) { - echo "error: " . $_SESSION["errorMessage"] . "
"; - $_SESSION["errorMessage"] = NULL; - } - print_r($artifacts); - - // document type browsing - echo "document type browse- get list of doc types
"; - $results = $db->browseByDocumentType(); - if (!is_null($_SESSION["errorMessage"])) { - echo "error: " . $_SESSION["errorMessage"] . "
"; - $_SESSION["errorMessage"] = NULL; - } - print_r($results); - - // pick the first document type id - srand ((float) microtime() * 10000000); - $documentTypeID = $results["documentTypes"][0]["id"]; - $documentTypeName = $results["documentTypes"][0]["name"]; - echo "browsing by document type = $documentTypeID; name=$documentTypeName
"; - $artifacts = $db->browseByDocumentType($documentTypeID); - if (!is_null($_SESSION["errorMessage"])) { - echo "error: " . $_SESSION["errorMessage"] . "
"; - $_SESSION["errorMessage"] = NULL; - } - print_r($artifacts); - - echo "