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 | 24 | // ------------------------------- |
| 25 | 25 | |
| 26 | 26 | if (checkSession()) { |
| 27 | - $default->log->debug("DocumentBrowser.php:: authorised flag:" . $_SESSION["authorised"]); | |
| 28 | 27 | |
| 29 | 28 | echo "<pre>"; |
| 30 | - | |
| 31 | 29 | $db = new DocumentBrowser(); |
| 32 | 30 | |
| 33 | 31 | // default browse- should resolve to root folder |
| ... | ... | @@ -38,7 +36,7 @@ if (checkSession()) { |
| 38 | 36 | $_SESSION["errorMessage"] = NULL; |
| 39 | 37 | } |
| 40 | 38 | print_r($artifacts); |
| 41 | - | |
| 39 | + | |
| 42 | 40 | // now supply a folderid |
| 43 | 41 | $folderID = 3; |
| 44 | 42 | echo "browse- starting at folder (folderID=$folderID)<br>"; |
| ... | ... | @@ -51,17 +49,15 @@ if (checkSession()) { |
| 51 | 49 | |
| 52 | 50 | // browse by category |
| 53 | 51 | echo "category browse- return a list of categories:<br>"; |
| 54 | - $categories = $db->browseByCategory(); | |
| 52 | + $results = $db->browseByCategory(); | |
| 55 | 53 | if (!is_null($_SESSION["errorMessage"])) { |
| 56 | 54 | echo "error: " . $_SESSION["errorMessage"] . "<br>"; |
| 57 | 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 | 61 | echo "browsing by category = $category<br>"; |
| 66 | 62 | $artifacts = $db->browseByCategory($category); |
| 67 | 63 | if (!is_null($_SESSION["errorMessage"])) { |
| ... | ... | @@ -72,25 +68,25 @@ if (checkSession()) { |
| 72 | 68 | |
| 73 | 69 | // document type browsing |
| 74 | 70 | echo "document type browse- get list of doc types<br>"; |
| 75 | - $documentTypes = $db->browseByDocumentType(); | |
| 71 | + $results = $db->browseByDocumentType(); | |
| 76 | 72 | if (!is_null($_SESSION["errorMessage"])) { |
| 77 | 73 | echo "error: " . $_SESSION["errorMessage"] . "<br>"; |
| 78 | 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 | 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 | 83 | $artifacts = $db->browseByDocumentType($documentTypeID); |
| 88 | 84 | if (!is_null($_SESSION["errorMessage"])) { |
| 89 | 85 | echo "error: " . $_SESSION["errorMessage"] . "<br>"; |
| 90 | 86 | $_SESSION["errorMessage"] = NULL; |
| 91 | 87 | } |
| 92 | 88 | print_r($artifacts); |
| 93 | - | |
| 89 | + | |
| 94 | 90 | echo "</pre>"; |
| 95 | 91 | } else { |
| 96 | 92 | // FIXME: redirect to no permission page | ... | ... |