import junit.framework.TestCase;
import java.io.CharArrayReader;
+import java.io.File;
/**
* Test the PHP Parser with different PHP snippets
*/
public void testPHPParser() {
- checkHTML("<?php" +
- "\n//if (!isset($AtreidesLanguage)) $AtreidesLanguage='french';" +
- "\n$AtreidesLanguage='french';" +
- "\n$for = 1;" +
- "\n\ninclude_once('php/template.inc');" +
- "\ninclude ' php/class.PHPLIBTemplateAdaptor.php';" +
- "\ninclude 'php/class.CachedTemplate.php';" +
- "\n$_PHPLIB['libdir']='php/';" +
- "\ninclude 'php/oohforms.inc';" +
- "\n include 'objet/outil.php';" +
- "\ninclude 'objet/metier.php';" +
- "\ninclude 'php/db_mysql.inc';" +
- "\ninclude 'objet/db5.php';" +
- "\ninclude 'objet/gui.php';" +
- "\ninclude 'objet/application.php';" +
- "\n//----------------------------------------------------" +
- "\n// Objets du site" +
- "\n//----------------------------------------------------" +
- "\n// Objets de base de donnée" +
- "\ninclude 'atreides/db_soft.php';" +
- "\n// Objets metier" +
- "\ninclude 'atreides/soft.php';" +
- "\n// Objets application" +
- "\ninclude 'atreides/atreides.php';" +
- "\n$AtreidesTheme='normal/$AtreidesLanguage';" +
- "\nif(Vide($oCentral)) $oCentral='Soft';" +
- "\nif (vide($oModeCentral)) $oModeCentral = 'recherche';" +
- "\nif (Vide($theme)) $theme='normal';" +
- "\nif (Vide($mode)) $mode='visu';" +
- "\n$Atreides=new Atreides($mode,$ini);" +
- "\n$Atreides->tabAffich['oModeCentral']=$oModeCentral;" +
- "\nob_start('ob_gzhandler');" +
- "\necho $Atreides->vueMetier('visu',$AtreidesTheme);" +
+ //checkHTML(new File("class.adm_gestuser.php"));
+ checkHTML("<?php ec ho 'coucou'; ?>" +
+ "\n dfgdfgfdfg" +
+ "\n" +
+ "\n" +
+ "<?php" +
+ "\necho ' caca';" +
+ "\n?>" +
+ "dfgdfg" +
+ "\ndsfgdf");
+ checkHTML("<?php echo 'coucou'; ?>" +
+ "\n dfgdfgfdfg" +
+ "\n" +
+ "\n" +
+ "<?php" +
+ "\necho ' caca';" +
"\n?>");
checkHTML("<html>sdfsdf <?php phpinfo(); ?>");
checkHTML("\n\n\n\n <?php print \"Hello world\"?> ");
}
+ private void checkHTML(File strEval) {
+ try {
+ System.out.println("strEval = " + strEval.toString());
+ parser.htmlParserTester(strEval);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+
+ }
/**
* The JUnit setup method
*/