X-Git-Url: http://git.phpeclipse.com 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 index f0c034a..c8b0443 100644 --- 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 @@ -5,14 +5,13 @@ package net.sourceforge.phpeclipse.tests.parser; * 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 junit.framework.TestCase; -import net.sourceforge.phpdt.internal.compiler.parser.Parser; +import net.sourceforge.phpdt.core.tests.util.AbstractCompilerTest; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; /** * Tests the php parser */ -public class PHPParserTestCase extends TestCase { - Parser parser; +public class PHPParserTestCase extends AbstractCompilerTest { +// Parser parser; public PHPParserTestCase(String name) { super(name); } @@ -20,6 +19,23 @@ public class PHPParserTestCase extends TestCase { * Test the PHP Parser with different PHP snippets */ public void testPHPParser() { + checkHTML(" "); + checkHTML("\n" + + "test me\n" + + ""); + + checkHTML(""); + checkPHP("function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)\r\n" + + "{ static $drop_char_match = array(\'^\', \'$\'); }"); + + checkPHP("if ($topic<1) { $topic = 1;}"); + checkPHP("$this->result_field_names[$result_id][] = odbc_field_name($result_id, $i);"); + checkPHP("$db->sql_query($sql);"); + checkPHP("$val = $$add;"); // checkPHP("if(!$result = mysql_query($sql)) return(array());"); checkPHP("class test { function &fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null) \n{ \n } \n }"); // Bugs item #690938 @@ -51,7 +67,7 @@ public class PHPParserTestCase extends TestCase { 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("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));"); @@ -62,8 +78,8 @@ public class PHPParserTestCase extends TestCase { 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("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" @@ -100,31 +116,44 @@ public class PHPParserTestCase extends TestCase { 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 "); - checkHTML(""); - checkHTML(""); - checkHTML(" foo "); - checkHTML(" "); - checkHTML(""); +// checkHTML("\n\n\n\n "); +// checkHTML(""); +// checkHTML(""); +// checkHTML(" foo "); +// checkHTML(" "); +// checkHTML(""); } private void checkPHP(String strEval) { if (Scanner.DEBUG) { System.out.println("\n------------------------------------"); System.out.println(strEval); } - parser.phpParserTester(strEval, 1); + checkParsePHP( + strEval.toCharArray(), + ""); +// parser.phpParserTester(strEval, 1); } private void checkHTML(String strEval) { if (Scanner.DEBUG) { System.out.println("\n------------------------------------"); System.out.println(strEval); } - parser.parse(strEval); - } - /** - * The JUnit setup method - */ - protected void setUp() { - parser = new Parser(null); + checkParseHTML( + strEval.toCharArray(), + ""); +// parser.phpParserTester(strEval, 1); } +// private void checkHTML(String strEval) { +// if (Scanner.DEBUG) { +// System.out.println("\n------------------------------------"); +// System.out.println(strEval); +// } +// parser.parse(strEval); +// } +// /** +// * The JUnit setup method +// */ +// protected void setUp() { +// parser = new Parser(null); +// } }