1 package junit.sourceforge.phpeclipse;
2 /**********************************************************************
3 Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de
4 All rights reserved. This program and the accompanying materials
5 are made available under the terms of the Common Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/cpl-v10.html
8 **********************************************************************/
10 import junit.framework.TestCase;
12 import net.sourceforge.phpeclipse.phpeditor.PHPParser;
15 * Tests the php parser
17 public class PHPParserTestCase extends TestCase {
21 public PHPParserTestCase(String name) {
26 * Test the PHP Parser with different PHP snippets
28 public void testPHPParser() {
29 check("if (isset($test)) { }");
30 check("require_once(\"mainfile.php\"); ");
31 check("if (eregi(\"footer.php\",$PHP_SELF)) {\n" +
32 "Header(\"Location: index.php\");\n" +
39 public void check(String strEval) {
40 parser.start(strEval, 1);
44 * The JUnit setup method
46 protected void setUp() {
47 parser = new PHPParser();