intial core test module
authorkhartlage <khartlage>
Mon, 10 Mar 2003 20:04:47 +0000 (20:04 +0000)
committerkhartlage <khartlage>
Mon, 10 Mar 2003 20:04:47 +0000 (20:04 +0000)
net.sourceforge.phpeclipse.tests/.classpath
net.sourceforge.phpeclipse.tests/.project [new file with mode: 0644]
net.sourceforge.phpeclipse.tests/.template [new file with mode: 0644]
net.sourceforge.phpeclipse.tests/plugin.xml [new file with mode: 0644]
net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java [new file with mode: 0644]
net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java [new file with mode: 0644]

index 77fafa6..8fb0ce4 100644 (file)
@@ -27,8 +27,9 @@
         path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.1.0/runtime.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.runtime_2.1.0/runtimesrc.zip"/>
     <classpathentry kind="var"
         path="ECLIPSE_HOME/plugins/org.eclipse.core.boot_2.1.0/boot.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.boot_2.1.0/bootsrc.zip"/>
+    <classpathentry kind="var"
+        path="ECLIPSE_HOME/plugins/org.junit_3.8.1/junit.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.junit_3.8.1/junitsrc.zip"/>
     <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
     <classpathentry kind="src" path="/net.sourceforge.phpeclipse"/>
-    <classpathentry kind="lib" path="C:/eclipse/plugins/org.junit_3.8.1/junit.jar"/>
     <classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/net.sourceforge.phpeclipse.tests/.project b/net.sourceforge.phpeclipse.tests/.project
new file mode 100644 (file)
index 0000000..86b9694
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>net.sourceforge.phpeclipse.tests</name>
+       <comment></comment>
+       <projects>
+               <project>net.sourceforge.phpeclipse</project>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/net.sourceforge.phpeclipse.tests/.template b/net.sourceforge.phpeclipse.tests/.template
new file mode 100644 (file)
index 0000000..f3bcd41
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<form>\r
+   <p/><p><b>Tips on working with this plug-in project</b></p><li>For the view of the new plug-in at a glance, go to the <img href="pageImage"/><a href="OverviewPage">Overview</a>.</li><li>You can test the contributions of this plug-in by launching another instance of the workbench. On the <b>Run</b> menu, click <b>Run As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.run">Run-time Workbench</a> from the available choices.</li><li>You can add more functionality to this plug-in by adding extensions using the <a href="action.newExtension">New Extension Wizard</a>.</li><li>The plug-in project contains Java code that you can debug. Place breakpoints in Java classes. On the <b>Run</b> menu, select <b>Debug As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.debug">Run-time Workbench</a> from the available choices.</li>\r
+</form>\r
diff --git a/net.sourceforge.phpeclipse.tests/plugin.xml b/net.sourceforge.phpeclipse.tests/plugin.xml
new file mode 100644 (file)
index 0000000..46a5d57
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin
+   id="net.sourceforge.phpeclipse.tests"
+   name="Core Tests"
+   version="1.0.0"
+   provider-name="eclipseproject.de">
+
+   <runtime>
+      <library name="coretests.jar"/>
+   </runtime>
+   <requires>
+      <import plugin="org.eclipse.core.resources"/>
+      <import plugin="org.eclipse.ui"/>
+      <import plugin="org.eclipse.help"/>
+      <import plugin="org.eclipse.swt"/>
+      <import plugin="org.eclipse.debug.ui"/>
+      <import plugin="org.apache.xerces"/>
+      <import plugin="org.junit"/>
+      <import plugin="org.eclipse.update.ui"/>
+   </requires>
+</plugin>
diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java
new file mode 100644 (file)
index 0000000..b460407
--- /dev/null
@@ -0,0 +1,322 @@
+package net.sourceforge.phpeclipse.tests.parser;
+/**********************************************************************
+Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+**********************************************************************/
+
+import net.sourceforge.phpdt.internal.compiler.parser.Parser;
+import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
+
+import org.eclipse.core.runtime.CoreException;
+import junit.framework.TestCase;
+
+/**
+ *  Tests the php parser
+ */
+public class PHPManualTestCase extends TestCase {
+
+  Parser parser;
+
+  public PHPManualTestCase(String name) {
+    super(name);
+  }
+
+  /**
+   *  Test the PHP Parser with different PHP snippets
+   */
+  public void testPHPParser() {
+    // Bugs item #690938
+    checkPHP(
+      "    echo \"This is a test\"; // This is a one-line c++ style comment\n"
+        + "    /* This is a multi line comment\n"
+        + "       yet another line of comment */\n"
+        + "    echo \"This is yet another test\";\n"
+        + "    echo \"One Final Test\"; # This is shell-style style comment \n");
+    checkPHP(
+      "$bool = TRUE;   // a boolean\n"
+        + "$str  = \"foo\";  // a string\n"
+        + "$int  = 12;     // an integer\n"
+        + "\n"
+        + "echo gettype($bool); // prints out \"boolean\"\n"
+        + "echo gettype($str);  // prints out \"string\"\n"
+        + ""
+        + "// If this is an integer, increment it by four\n"
+        + "if (is_int($int)) {\n"
+        + "    $int += 4;\n"
+        + "}\n"
+        + "\n"
+        + "// If $bool is a string, print it out\n"
+        + "// (does not print out anything)\n"
+        + "if (is_string($bool)) {\n"
+        + "    echo \"String: $bool\";\n"
+        + "}\n");
+
+    checkPHP("$foo = True; // assign the value TRUE to $foo");
+
+    checkPHP(
+      "// == is an operator which test\n"
+        + "// equality and returns a boolean\n"
+        + "if ($action == \"show_version\") {\n"
+        + "    echo \"The version is 1.23\";\n"
+        + "}\n"
+        + "\n"
+        + "// this is not necessary...\n"
+        + "if ($show_separators == TRUE) {\n"
+        + "    echo \"<hr>\\n\";\n"
+        + "}\n"
+        + "\n"
+        + "// ...because you can simply type\n"
+        + "if ($show_separators) {\n"
+        + "    echo \"<hr>\\n\";\n"
+        + "}");
+
+    checkPHP(
+      "echo gettype((bool) \"\");        // bool(false)\n"
+        + "echo gettype((bool) 1);         // bool(true)\n"
+        + "echo gettype((bool) -2);        // bool(true)\n"
+        + "echo gettype((bool) \"foo\");     // bool(true)\n"
+        + "echo gettype((bool) 2.3e5);     // bool(true)\n"
+        + "echo gettype((bool) array(12)); // bool(true)\n"
+        + "echo gettype((bool) array());   // bool(false)\n");
+
+    checkPHP(
+      "$a = 1234; # decimal number\n"
+        + "$a = -123; # a negative number\n"
+        + "$a = 0123; # octal number (equivalent to 83 decimal)\n"
+        + "$a = 0x1A; # hexadecimal number (equivalent to 26 decimal)\n");
+
+    checkPHP(
+      "$large_number =  2147483647;\n"
+        + "var_dump($large_number);\n"
+        + "// output: int(2147483647)\n"
+        + "\n"
+        + "$large_number =  2147483648;\n"
+        + "var_dump($large_number);\n"
+        + "// output: float(2147483648)\n"
+        + ""
+        + "// this goes also for hexadecimal specified integers:\n"
+        + "var_dump( 0x80000000 );\n"
+        + "// output: float(2147483648)\n"
+        + "\n"
+        + "$million = 1000000;\n"
+        + "$large_number =  50000 * $million;\n"
+        + "var_dump($large_number);\n"
+        + "// output: float(50000000000)\n");
+
+    checkPHP(
+      "var_dump(25/7);         // float(3.5714285714286)\n"
+        + "var_dump((int) (25/7)); // int(3)\n"
+        + "var_dump(round(25/7));  // float(4)");
+
+    checkPHP("echo (int) ( (0.1+0.7) * 10 ); // echoes 7!");
+
+    checkPHP("$a = 1.234; " + "$b = 1.2e3; " + "$c = 7E-10;");
+
+    checkPHP(
+      "echo 'this is a simple string';\n"
+        + "\n"
+        + "echo 'You can also have embedded newlines in \n"
+        + "strings this way as it is\n"
+        + "okay to do';\n"
+        + "\n"
+        + "// Outputs: \"I'll be back\"\n"
+        + "echo 'Arnold once said: \"I\\'ll be back\"';\n"
+        + "\n"
+        + "// Outputs: You deleted C:\\*.*?\n"
+        + "echo 'You deleted C:\\\\*.*?';\n"
+        + "\n"
+        + "// Outputs: You deleted C:\\*.*?\n"
+        + "echo 'You deleted C:\\\\*.*?';\n"
+        + "\n"
+        + "// Outputs: This will not expand: \\n a newline\n"
+        + "echo 'This will not expand: \\n a newline';\n"
+        + "\n"
+        + "// Outputs: Variables do not $expand $either\n"
+        + "echo 'Variables do not $expand $either';\n");
+
+    checkPHP(
+      "$str = <<<EOD\n"
+        + "Example of string\n"
+        + "spanning multiple lines\n"
+        + "using heredoc syntax.\n"
+        + "EOD;\n"
+        + "\n"
+        + "/* More complex example, with variables. */\n"
+        + "class foo\n"
+        + "{\n"
+        + "    var $foo;\n"
+        + "    var $bar;\n"
+        + "\n"
+        + "    function foo()\n"
+        + "    {\n"
+        + "        $this->foo = 'Foo';\n"
+        + "        $this->bar = array('Bar1', 'Bar2', 'Bar3');\n"
+        + "    }\n"
+        + "}\n"
+        + "\n"
+        + "$foo = new foo();\n"
+        + "$name = 'MyName';\n"
+        + "\n"
+        + "echo <<<EOT\n"
+        + "My name is \"$name\". I am printing some $foo->foo.\n"
+        + "Now, I am printing some {$foo->bar[1]}.\n"
+        + "This should print a capital 'A': \\x41\n"
+        + "EOT;\n");
+
+    checkPHP("echo \"This works: \" . $arr['foo'][3];");
+
+    checkPHP("echo \"\\$foo==$foo; type is \" . gettype ($foo) . \"<br />\\n\";");
+
+    checkPHP(
+      "$arr = array(\"foo\" => \"bar\", 12 => true);\n"
+        + "\n"
+        + "echo $arr[\"foo\"]; // bar\n"
+        + "echo $arr[12];    // 1\n");
+
+    checkPHP(
+      "// This array is the same as ...\n"
+        + "array(5 => 43, 32, 56, \"b\" => 12);\n"
+        + "\n"
+        + "// ...this array\n"
+        + "array(5 => 43, 6 => 32, 7 => 56, \"b\" => 12);\n");
+
+    checkPHP(
+      "$arr = array(5 => 1, 12 => 2);\n"
+        + "\n"
+        + "$arr[] = 56;    // This is the same as $arr[13] = 56;\n"
+        + "                // at this point of the script\n"
+        + "\n"
+        + "$arr[\"x\"] = 42; // This adds a new element to\n"
+        + "                // the array with key \"x\"\n"
+        + "                \n"
+        + "unset($arr[5]); // This removes the element from the array\n"
+        + "\n"
+        + "unset($arr);    // This deletes the whole array\n");
+
+    checkPHP("$foo[bar] = 'enemy';\n" + "echo $foo[bar];");
+
+    checkPHP(
+      "$a = array( 'color' => 'red',\n"
+        + "            'taste' => 'sweet',\n"
+        + "            'shape' => 'round',\n"
+        + "            'name'  => 'apple',\n"
+        + "                       4        // key will be 0\n"
+        + "          );\n"
+        + "\n"
+        + "// is completely equivalent with\n"
+        + "$a['color'] = 'red';\n"
+        + "$a['taste'] = 'sweet';\n"
+        + "$a['shape'] = 'round';\n"
+        + "$a['name']  = 'apple';\n"
+        + "$a[]        = 4;        // key will be 0\n"
+        + "\n"
+        + "$b[] = 'a';\n"
+        + "$b[] = 'b';\n"
+        + "$b[] = 'c';\n"
+        + "// will result in the array array(0 => 'a' , 1 => 'b' , 2 => 'c'),\n"
+        + "// or simply array('a', 'b', 'c')\n");
+
+    checkPHP(
+      "foreach ($colors as $key => $color) {\n"
+        + "    // won't work:\n"
+        + "    //$color = strtoupper($color);\n"
+        + "    \n"
+        + "    // works:\n"
+        + "    $colors[$key] = strtoupper($color);\n"
+        + "}\n"
+        + "print_r($colors);\n");
+
+    checkPHP(
+      "$fruits = array ( \"fruits\"  => array ( \"a\" => \"orange\",\n"
+        + "                                       \"b\" => \"banana\",\n"
+        + "                                       \"c\" => \"apple\"\n"
+        + "                                     ),\n"
+        + "                  \"numbers\" => array ( 1,\n"
+        + "                                       2,\n"
+        + "                                       3,\n"
+        + "                                       4,\n"
+        + "                                       5,\n"
+        + "                                       6,\n"
+        + "                                     ),\n"
+        + "                  \"holes\"   => array (      \"first\",\n"
+        + "                                       5 => \"second\",\n"
+        + "                                            \"third\"\n"
+        + "                                     )\n"
+        + "                );\n"
+        + "\n"
+        + "// Some examples to address values in the array above \n"
+        + "echo $fruits[\"holes\"][5];    // prints \"second\"\n"
+        + "echo $fruits[\"fruits\"][\"a\"]; // prints \"orange\"\n"
+        + "unset($fruits[\"holes\"][0]);  // remove \"first\"\n"
+        + "\n"
+        + "// Create a new multi-dimensional array\n"
+        + "$juices[\"apple\"][\"green\"] = \"good\"; \n");
+
+    checkPHP("$arr3 = &$arr1;");
+
+    checkPHP(
+      "class foo\n"
+        + "{\n"
+        + "    function do_foo()\n"
+        + "    {\n"
+        + "        echo \"Doing foo.\"; \n"
+        + "    }\n"
+        + "}\n"
+        + "\n"
+        + "$bar = new foo;\n"
+        + "$bar->do_foo();\n");
+
+    checkPHP(
+      "$obj = (object) 'ciao';\n" + 
+      "echo $obj->scalar;  // outputs 'ciao'");
+
+    checkPHP("$var = NULL;");
+
+    checkPHP("$var = \"Bob\";\n" +
+       "$Var = \"Joe\";\n" +
+       "echo \"$var, $Var\";      // outputs \"Bob, Joe\"\n" +
+       "\n" +
+   //  "$4site = 'not yet';     // invalid; starts with a number\n" +
+       "$_4site = 'not yet';    // valid; starts with an underscore\n" +
+       "$täyte = 'mansikka';  \n");
+
+    checkPHP("");
+
+    checkPHP("");
+
+    checkPHP("");
+  }
+
+  private void checkPHP(String strEval) {
+    try {
+      if (Scanner.DEBUG) {
+        System.out.println("\n------------------------------------");
+        System.out.println(strEval);
+      }
+      parser.phpParserTester(strEval, 1);
+    } catch (CoreException e) {
+    }
+  }
+
+  private void checkHTML(String strEval) {
+    try {
+      if (Scanner.DEBUG) {
+        System.out.println("\n------------------------------------");
+        System.out.println(strEval);
+      }
+      parser.parse(strEval);
+    } catch (CoreException e) {
+    }
+  }
+
+  /**
+   *  The JUnit setup method
+   */
+  protected void setUp() {
+    parser = new Parser(null);
+  }
+
+}
diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java
new file mode 100644 (file)
index 0000000..4a21c36
--- /dev/null
@@ -0,0 +1,165 @@
+package net.sourceforge.phpeclipse.tests.parser;
+/**********************************************************************
+Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+**********************************************************************/
+
+import net.sourceforge.phpdt.internal.compiler.parser.Parser;
+import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
+
+import org.eclipse.core.runtime.CoreException;
+import junit.framework.TestCase;
+
+/**
+ *  Tests the php parser
+ */
+public class PHPParserTestCase extends TestCase {
+
+  Parser parser;
+
+  public PHPParserTestCase(String name) {
+    super(name);
+  }
+
+  /**
+   *  Test the PHP Parser with different PHP snippets
+   */
+  public void testPHPParser() {
+    // Bugs item #690938
+    checkPHP(
+      "$ebus_sql['sel_url_list'] = <<<EOS\n"
+        + "select rtrim(URL_NAME) as url_name\n"
+        + "    , rtrim(URL) as url\n"
+        + "    , rtrim(URL_DESC) as url_desc\n"
+        + "from appl_url\n"
+        + "where appl_instnc_sk = <<INSTNC>>\n"
+        + "and appl_sect_deftn_sk = <<SECT>>\n"
+        + "order by url_ord\n"
+        + "EOS;\n");
+
+    checkPHP("foreach ($HTTP_GET_VARS as $secvalue) { }");
+    checkPHP("\"\\\"\";");
+    checkPHP("\"\\[addsig]\"");
+    checkPHP("$v->read();");
+    checkPHP("$add = 'a'.$i;$val = $$add;");
+    checkPHP("($a==\"b\") || (c($this->x)==\"d\");");
+    checkPHP("(substr($this->file, 0, 2) == \"MM\");");
+    checkPHP("(substr($this->file, 0, 2) == \"MM\") || substr($this->file, 0, 2) == \"II\";");
+    checkPHP("return (substr($this->file, 0, 2) == \"MM\") || substr($this->file, 0, 2) == \"II\";");
+    checkPHP("$this->highlightfile->linkscripts{$category}");
+    checkPHP("$code = call_user_method($this->highlightfile->linkscripts{$category}, $this->highlightfile, $oldword, $this->output_module)");
+    checkPHP("$this->startmap[$startcurrtag]();");
+    checkPHP("new $this->startmap[$startcurrtag]();");
+    checkPHP("$this->highlightfile = new $this->startmap[$startcurrtag]();");
+    checkPHP("echo \"Test\", \"me\";");
+    checkPHP("print (\"Test me\");");
+    checkPHP("$s = <<<HEREDOC \n dskjfhskj\n \n\nHEREDOC;");
+    checkPHP("$a == 0 ? print \"true\" : print \"false\";");
+    checkPHP("if(!$result = mysql_query($sql)) return(array());");
+    checkPHP("class test { function &fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null) \n{ \n } \n }");
+    checkPHP("call_user_method_array($function_name[1], ${$objectname}, $arguments);");
+    checkPHP("@$connect_function($dbhost, $user, $pw);");
+    checkPHP("$conn = @$connect_function($dbhost, $user, $pw);");
+    checkPHP("global ${$objectname}; ");
+    checkPHP("class DB_mssql extends DB_common { var $connection; var $phptype, $dbsyntax; }  ");
+    checkPHP("unset($this->blockvariables[$block][$varname]);");
+    checkPHP("new IT_Error(\"The block '$block' was not found in the template.\", __FILE__, __LINE__);");
+    checkPHP("for ($i=156, $j=0; $i<512; $i++, $j++) $v_checksum += ord(substr($v_binary_data_last,$j,1));");
+    checkPHP("define('MAIL_MIME_CRLF', $crlf, true);");
+    checkPHP("static $last_run = 0;");
+    checkPHP("unset($headers['Subject']);");
+    checkPHP("switch($func) {\n case \"f0\":\n case \"f1\":\n f1();\n break; \n case \"tt\": \n default: \n f0(); \n break;\n }");
+    checkPHP("function validateAndParseResponse($code, &$arguments) { }");
+    checkPHP("$options = Console_Getopt::getopt($argv, \"h?v:e:p:d:\");");
+    checkPHP("$this->container = new $container_class($container_options);");
+    checkPHP("class Cmd extends PEAR { var $arrSetting     = array(); }");
+    checkPHP("class Cmd extends PEAR { var $arrSetting     = array(), $i=10; }");
+    checkPHP("if (isset($test)) { } elseif (isset($lang)) { }");
+    checkPHP("require_once(\"mainfile.php\");  ");
+    checkPHP(
+      "if (eregi(\"footer.php\",$PHP_SELF)) {\n"
+        + "Header(\"Location: index.php\");\n"
+        + "die();\n"
+        + "}\n");
+    checkPHP(
+      "while (eregi(\"footer.php\",$PHP_SELF)) {\n"
+        + "Header(\"Location: index.php\");\n"
+        + "die();\n"
+        + "}\n");
+    checkPHP(
+      "while (eregi(\"footer.php\",$PHP_SELF)) :\n"
+        + "Header(\"Location: index.php\");\n"
+        + "die();\n"
+        + "endwhile;\n");
+    checkPHP("$tipath = \"images/topics/\";");
+    checkPHP("$reasons = array(\"1\", \"2\",\"test\");");
+    checkPHP("if ($home == 1) { message_box(); blocks(Center);}");
+    checkPHP("$bresult = sql_query(\"select * from \".$prefix.\"_banner WHERE type='0' AND active='1'\", $dbi);");
+    checkPHP("switch($func) {\n case \"f1\":\n f1();\n break; \n default: \n f0(); \n break;\n }");
+    checkPHP("list ($catid) = sql_fetch_row($result, $dbi);");
+    checkPHP("if (!$name) { \n }");
+    checkPHP("mt_srand((double)microtime()*1000000);");
+    checkPHP("$alttext = ereg_replace(\"\\\"\", \"\", $alttext);");
+    checkPHP("$message .= \"\"._THISISAUTOMATED.\"\\n\\n\";");
+    checkPHP("if (!empty($pass) AND $pass==$passwd) { }");
+    checkPHP("$AllowableHTML = array(\"b\"=>1,\n \"i\"=>1);");
+    checkPHP("if ($term{0}!=$firstChar) {}");
+    checkPHP(
+      "echo \"<center><b>\"._NOADMINYET.\"</b></center><br><br>\"\n"
+        + ".\"<form action=\\\"admin.php\\\" method=\\\"post\\\">\"\n"
+        + ".\"<tr><td><b>\"._NICKNAME.\":</b></td><td><input type=\\\"text\\\" name=\\\"name\\\" size=\\\"30\\\" maxlength=\\\"25\\\"></td></tr>\"\n"
+        + ";");
+    checkPHP("/* \n overLib is from Eric Bosrup (http://www.bosrup.com/web/overlib/) \n */");
+    checkPHP("if ($arrAtchCookie[1]==0 && $IdAtchPostId!=null){  } ");
+    checkPHP("$arrAtchCookie[1] -= filesize(realpath($AtchTempDir).\"/\".$xattachlist)/ 1024; ");
+    checkPHP(
+      "if (!isset($message)){ \n"
+        + "$message = $myrow[post_text];\n"
+        + "$message = eregi_replace(\"\\[addsig]\", \"\\n-----------------\\n\" .    $myrow[user_sig], $message); \n"
+        + "$message = str_replace(\"<BR>\", \"\\n\", $message); \n"
+        + "$message = str_replace(\"<br>\", \"\\n\", $message); \n } ");
+    checkPHP("do {$array[] = array(\"$myrow[uid]\" => \"$myrow[uname]\"); } while($myrow = mysql_fetch_array($result));");
+    checkPHP("$ol = new Overlib();");
+    checkPHP("$risultato = mysql_query($sql) or\n    die(mysql_error());");
+
+    checkHTML("\n\n\n\n  <?php print \"Hello world\" ?>");
+    checkHTML("<?php phpinfo(); ?>");
+    checkHTML("<?php phpinfo()?>");
+    checkHTML("<?php phpinfo(); ?> foo <?php phpinfo(); ?>");
+    checkHTML(" <?php //this is a line comment ?>");
+    checkHTML("<?php echo $module_name ?>");
+  }
+
+  private void checkPHP(String strEval) {
+    try {
+      if (Scanner.DEBUG) {
+        System.out.println("\n------------------------------------");
+        System.out.println(strEval);
+      }
+      parser.phpParserTester(strEval, 1);
+    } catch (CoreException e) {
+    }
+  }
+
+  private void checkHTML(String strEval) {
+    try {
+      if (Scanner.DEBUG) {
+        System.out.println("\n------------------------------------");
+        System.out.println(strEval);
+      }
+      parser.parse(strEval);
+    } catch (CoreException e) {
+    }
+  }
+
+  /**
+   *  The JUnit setup method
+   */
+  protected void setUp() {
+    parser = new Parser(null);
+  }
+
+}