24 require_once(dirname(__FILE__) .
'/../common-active.php');
43 print
"Start unit test for common-active.php\n";
44 print
"test function ActiveHTTPscript\n";
47 $script_header =
"<script language='javascript'>\n<!--\n";
48 $script_foot =
"\n// -->\n</script>\n";
50 $html_expect .=
"var test=null;\n";
52 $html_expect .=
"function test_Get(Url)\n";
53 $html_expect .=
"{\n";
54 $html_expect .=
"if (window.XMLHttpRequest)\n";
55 $html_expect .=
" {\n";
56 $html_expect .=
" test=new XMLHttpRequest();\n";
57 $html_expect .=
" }\n";
59 $html_expect .=
"else if (window.ActiveXObject)\n";
60 $html_expect .=
" {\n";
61 $html_expect .=
" test=new ActiveXObject('Microsoft.XMLHTTP');\n";
62 $html_expect .=
" }\n";
64 $html_expect .=
"if (test!=null)\n";
65 $html_expect .=
" {\n";
66 $html_expect .=
" test.onreadystatechange=test_Reply;\n";
72 $html_expect .=
" test.open('GET',Url,true);\n";
73 $html_expect .=
" test.send(null);\n";
74 $html_expect .=
" }\n";
75 $html_expect .=
"else\n";
76 $html_expect .=
" {\n";
77 $html_expect .=
" alert('Your browser does not support XMLHTTP.');\n";
78 $html_expect .=
" return;\n";
79 $html_expect .=
" }\n";
80 $html_expect .=
"}\n";
81 $html_expect_script = $script_header.$html_expect.$script_foot;
82 $this->assertEquals($html_expect_script, $html_result);
86 $this->assertEquals($html_expect, $html_result);
87 print
"unit test for common-active.php end\n";
ActiveHTTPscript($RequestName, $IncludeScriptTags=1)
Given a function name, create the JavaScript needed for doing the request.
testActiveHTTPscript()
test for ActiveHTTPscript