13 require_once(dirname(__FILE__) .
'/../common-active.php');
23 protected function setUp() : void
32 print
"Start unit test for common-active.php\n";
33 print
"test function ActiveHTTPscript\n";
36 $script_header =
"<script language='javascript'>\n<!--\n";
37 $script_foot =
"\n// -->\n</script>\n";
38 $html_expect =
"var test=null;\n";
40 $html_expect .=
"function test_Get(Url)\n";
41 $html_expect .=
"{\n";
42 $html_expect .=
"if (window.XMLHttpRequest)\n";
43 $html_expect .=
" {\n";
44 $html_expect .=
" test=new XMLHttpRequest();\n";
45 $html_expect .=
" }\n";
47 $html_expect .=
"else if (window.ActiveXObject)\n";
48 $html_expect .=
" {\n";
49 $html_expect .=
" test=new ActiveXObject('Microsoft.XMLHTTP');\n";
50 $html_expect .=
" }\n";
52 $html_expect .=
"if (test!=null)\n";
53 $html_expect .=
" {\n";
54 $html_expect .=
" test.onreadystatechange=test_Reply;\n";
60 $html_expect .=
" test.open('GET',Url,true);\n";
61 $html_expect .=
" test.send(null);\n";
62 $html_expect .=
" }\n";
63 $html_expect .=
"else\n";
64 $html_expect .=
" {\n";
65 $html_expect .=
" alert('Your browser does not support XMLHTTP.');\n";
66 $html_expect .=
" return;\n";
67 $html_expect .=
" }\n";
68 $html_expect .=
"}\n";
69 $html_expect_script = $script_header.$html_expect.$script_foot;
70 $this->assertEquals($html_expect_script, $html_result);
74 $this->assertEquals($html_expect, $html_result);
75 print
"unit test for common-active.php end\n";
testActiveHTTPscript()
test for ActiveHTTPscript
ActiveHTTPscript($RequestName, $IncludeScriptTags=1)
Given a function name, create the JavaScript needed for doing the request.