From: Uwe Steinmann Date: Mon, 22 Nov 1999 16:09:07 +0000 (+0000) Subject: - test for hyperwave module X-Git-Tag: PRE_RETURN_REF_PATCH~312 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8b05d1137c9ec04b10818141e7c629d5578a485;p=php - test for hyperwave module --- diff --git a/tests/testhyperwave b/tests/testhyperwave new file mode 100644 index 0000000000..973489cf34 --- /dev/null +++ b/tests/testhyperwave @@ -0,0 +1,200 @@ +"ge:Hier der Titel", "Author"=>"Hier der Autor")); + echo $objrec."\n"; + $objrec .= "\nTitle=en:Here the title"; + echo "Add another title and convert it back to an object array\n"; + $objarr = hw_objrec2array($objrec); + list_attr($objarr); + } + + if($test_4 == "yes") { + echo "TEST 4 ----------------------------------------------\n"; + echo "Get the object array of document with id 0x".dechex($id)."\n"; + $objrec = hw_getobject($connect, $id); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $objarr = hw_objrec2array($objrec); + list_attr($objarr); + } + + if($test_5 == "yes") { + echo "TEST 5 ----------------------------------------------\n"; + echo "List the children of collection 0x".dechex($collid)."\n"; + $children = hw_childrenobj($connect, $collid); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $c_children = count($children) - 1; + for($i=0; $i<$c_children; $i++) { + $objarr = hw_objrec2array($children[$i]); + list_attr($objarr); + } + list_attr($children[$c_children]); + } + + if($test_6 == "yes") { + echo "TEST 6 ----------------------------------------------\n"; + echo "List the parents of object 0x".dechex($id)."\n"; + $parents = hw_getparentsobj($connect, $collid); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $c_parents = count($parents) - 1; + for($i=0; $i<$c_parents; $i++) { + $objarr = hw_objrec2array($parents[$i]); + list_attr($objarr); + } + list_attr($parents[$c_parents]); + } + + if($test_7 == "yes") { + echo "TEST 7 ----------------------------------------------\n"; + echo "Inserting a new text document into 0x".dechex($collid)."\n"; + $objrec = "Type=Document\nDocumentType=text\nName=HWTest\nTitle=en:Component\nMimeType=text/plain\nAuthor=".$username; + $contents = "Ein bischen Text"; + $doc = hw_new_document($objrec, $contents, strlen($contents)+1); + $objid = hw_insertdocument($connect, $collid, $doc); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $objrec = hw_getobject($connect, $objid); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $objarr = hw_objrec2array($objrec); + list_attr($objarr); + } + + if($test_8 == "yes") { + echo "TEST 8 ----------------------------------------------\n"; + echo "Removing text document just inserted\n"; + $kk[0] = (int) $objid; + hw_mv($connect, $kk, $collid, 0); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + echo "If the document was really deleted you should see an error now\n"; + $objrec = hw_getobject($connect, $objid); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + } else { + $objarr = hw_objrec2array($objrec); + list_attr($objarr); + } + } + + if($test_9 == "yes") { + echo "TEST 9 ----------------------------------------------\n"; + echo "Searching for objects with $query\n"; + $objrecs = hw_getobjectbyqueryobj($connect, $query, -1); + $c_objrecs = count($objrecs) - 1; + echo "$c_objrecs found\n"; + for($i=0; $i<$c_objrecs; $i++) { + $objarr = hw_objrec2array($objrecs[$i]); + list_attr($objarr); + } + list_attr($objrecs[$c_objrecs]); + } + + hw_close($connect); +?>