Commit 9c52ce398324c664901c313b3e7a5abf8d33fb2d
1 parent
4007d83c
updated tests for DocumentBrowser changes
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@422 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
12 additions
and
16 deletions
tests/documentmanagement/DocumentBrowser.php
| @@ -24,10 +24,8 @@ require_once ("$default->owl_fs_root/lib/documentmanagement/DocumentBrowser.inc" | @@ -24,10 +24,8 @@ require_once ("$default->owl_fs_root/lib/documentmanagement/DocumentBrowser.inc" | ||
| 24 | // ------------------------------- | 24 | // ------------------------------- |
| 25 | 25 | ||
| 26 | if (checkSession()) { | 26 | if (checkSession()) { |
| 27 | - $default->log->debug("DocumentBrowser.php:: authorised flag:" . $_SESSION["authorised"]); | ||
| 28 | 27 | ||
| 29 | echo "<pre>"; | 28 | echo "<pre>"; |
| 30 | - | ||
| 31 | $db = new DocumentBrowser(); | 29 | $db = new DocumentBrowser(); |
| 32 | 30 | ||
| 33 | // default browse- should resolve to root folder | 31 | // default browse- should resolve to root folder |
| @@ -38,7 +36,7 @@ if (checkSession()) { | @@ -38,7 +36,7 @@ if (checkSession()) { | ||
| 38 | $_SESSION["errorMessage"] = NULL; | 36 | $_SESSION["errorMessage"] = NULL; |
| 39 | } | 37 | } |
| 40 | print_r($artifacts); | 38 | print_r($artifacts); |
| 41 | - | 39 | + |
| 42 | // now supply a folderid | 40 | // now supply a folderid |
| 43 | $folderID = 3; | 41 | $folderID = 3; |
| 44 | echo "browse- starting at folder (folderID=$folderID)<br>"; | 42 | echo "browse- starting at folder (folderID=$folderID)<br>"; |
| @@ -51,17 +49,15 @@ if (checkSession()) { | @@ -51,17 +49,15 @@ if (checkSession()) { | ||
| 51 | 49 | ||
| 52 | // browse by category | 50 | // browse by category |
| 53 | echo "category browse- return a list of categories:<br>"; | 51 | echo "category browse- return a list of categories:<br>"; |
| 54 | - $categories = $db->browseByCategory(); | 52 | + $results = $db->browseByCategory(); |
| 55 | if (!is_null($_SESSION["errorMessage"])) { | 53 | if (!is_null($_SESSION["errorMessage"])) { |
| 56 | echo "error: " . $_SESSION["errorMessage"] . "<br>"; | 54 | echo "error: " . $_SESSION["errorMessage"] . "<br>"; |
| 57 | $_SESSION["errorMessage"] = NULL; | 55 | $_SESSION["errorMessage"] = NULL; |
| 58 | } | 56 | } |
| 59 | - print_r($categories); | 57 | + print_r($results); |
| 60 | 58 | ||
| 61 | - // pick a random category | ||
| 62 | - srand ((float) microtime() * 10000000); | ||
| 63 | - $rand_keys = array_rand ($categories, 1); | ||
| 64 | - $category = $categories[$rand_keys]; | 59 | + // pick the first category |
| 60 | + $category = $results["categories"][0]; | ||
| 65 | echo "browsing by category = $category<br>"; | 61 | echo "browsing by category = $category<br>"; |
| 66 | $artifacts = $db->browseByCategory($category); | 62 | $artifacts = $db->browseByCategory($category); |
| 67 | if (!is_null($_SESSION["errorMessage"])) { | 63 | if (!is_null($_SESSION["errorMessage"])) { |
| @@ -72,25 +68,25 @@ if (checkSession()) { | @@ -72,25 +68,25 @@ if (checkSession()) { | ||
| 72 | 68 | ||
| 73 | // document type browsing | 69 | // document type browsing |
| 74 | echo "document type browse- get list of doc types<br>"; | 70 | echo "document type browse- get list of doc types<br>"; |
| 75 | - $documentTypes = $db->browseByDocumentType(); | 71 | + $results = $db->browseByDocumentType(); |
| 76 | if (!is_null($_SESSION["errorMessage"])) { | 72 | if (!is_null($_SESSION["errorMessage"])) { |
| 77 | echo "error: " . $_SESSION["errorMessage"] . "<br>"; | 73 | echo "error: " . $_SESSION["errorMessage"] . "<br>"; |
| 78 | $_SESSION["errorMessage"] = NULL; | 74 | $_SESSION["errorMessage"] = NULL; |
| 79 | } | 75 | } |
| 80 | - print_r($documentTypes); | 76 | + print_r($results); |
| 81 | 77 | ||
| 82 | - // pick a random document type | 78 | + // pick the first document type id |
| 83 | srand ((float) microtime() * 10000000); | 79 | srand ((float) microtime() * 10000000); |
| 84 | - $documentTypeID = array_rand ($documentTypes, 1); | ||
| 85 | - | ||
| 86 | - echo "browsing by document type = " . $documentTypeID . "<br>"; | 80 | + $documentTypeID = $results["documentTypes"][0]["id"]; |
| 81 | + $documentTypeName = $results["documentTypes"][0]["name"]; | ||
| 82 | + echo "browsing by document type = $documentTypeID; name=$documentTypeName<br>"; | ||
| 87 | $artifacts = $db->browseByDocumentType($documentTypeID); | 83 | $artifacts = $db->browseByDocumentType($documentTypeID); |
| 88 | if (!is_null($_SESSION["errorMessage"])) { | 84 | if (!is_null($_SESSION["errorMessage"])) { |
| 89 | echo "error: " . $_SESSION["errorMessage"] . "<br>"; | 85 | echo "error: " . $_SESSION["errorMessage"] . "<br>"; |
| 90 | $_SESSION["errorMessage"] = NULL; | 86 | $_SESSION["errorMessage"] = NULL; |
| 91 | } | 87 | } |
| 92 | print_r($artifacts); | 88 | print_r($artifacts); |
| 93 | - | 89 | + |
| 94 | echo "</pre>"; | 90 | echo "</pre>"; |
| 95 | } else { | 91 | } else { |
| 96 | // FIXME: redirect to no permission page | 92 | // FIXME: redirect to no permission page |