Changeset 380
- Timestamp:
- 03/09/07 23:59:56 (2 years ago)
- Files:
-
- trunk/build/manifests/testapp.mn (modified) (2 diffs)
- trunk/lib/jelix/tpl/jTplCompiler.class.php (modified) (6 diffs)
- trunk/testapp/modules/unittest/classes/jhtmlrespreporter.class.php (modified) (4 diffs)
- trunk/testapp/modules/unittest/classes/junittestcase.class.php (modified) (2 diffs)
- trunk/testapp/modules/unittest/classes/unittestservice.class.php (modified) (1 diff)
- trunk/testapp/modules/unittest/classes/utjtplexpr.class.php (added)
- trunk/testapp/modules/unittest/controllers/tpl.classic.php (added)
- trunk/testapp/modules/unittest/templates/menu.tpl (modified) (2 diffs)
- trunk/testapp/www/design/screen.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/testapp.mn
r372 r380 65 65 testevents.listener.php 66 66 utcreateurls.class.php 67 utjtplexpr.class.php 67 68 utparseurls.class.php 68 69 utselectoract.class.php … … 93 94 urlsig.classic.php 94 95 dao.classic.php 96 tpl.classic.php 95 97 96 98 cd testapp/var trunk/lib/jelix/tpl/jTplCompiler.class.php
r367 r380 44 44 T_PROTECTED, T_RETURN, T_STATIC, T_SWITCH, T_THROW, T_TRY, T_USE, T_VAR, T_WHILE); 45 45 46 pr ivate$_allowedInVar;47 pr ivate$_allowedInExpr;48 pr ivate$_allowedAssign;49 pr ivate$_allowedInForeach;46 protected $_allowedInVar; 47 protected $_allowedInExpr; 48 protected $_allowedAssign; 49 protected $_allowedInForeach; 50 50 51 51 private $_pluginPath=array(); … … 231 231 * @return string the corresponding php instruction 232 232 */ 233 pr ivatefunction _parseVariable($expr){233 protected function _parseVariable($expr){ 234 234 $tok = explode('|',$expr); 235 235 $res = $this->_parseFinal(array_shift($tok),$this->_allowedInVar); … … 271 271 * @return string the corresponding php instructions 272 272 */ 273 pr ivatefunction _parseFunction($name,$args){273 protected function _parseFunction($name,$args){ 274 274 $res=''; 275 275 switch($name) { … … 383 383 * @return array|string 384 384 */ 385 pr ivatefunction _parseFinal($string, $allowed=array(), $exceptchar=array(';'), $splitArgIntoArray=false){385 protected function _parseFinal($string, $allowed=array(), $exceptchar=array(';'), $splitArgIntoArray=false){ 386 386 $tokens = token_get_all('<?php '.$string.'?>'); 387 387 … … 474 474 } 475 475 476 pr ivatefunction _parseMeta($args, $fct=''){476 protected function _parseMeta($args, $fct=''){ 477 477 if(preg_match("/^(\w+)\s+(.*)$/",$args,$m)){ 478 478 $argfct=$this->_parseFinal($m[2],$this->_allowedInExpr); … … 493 493 * @return string the path of the plugin, or '' if not found 494 494 */ 495 pr ivatefunction _getPlugin($type, $name){495 protected function _getPlugin($type, $name){ 496 496 #if JTPL_STANDALONE 497 497 $treq = 'html'; trunk/testapp/modules/unittest/classes/jhtmlrespreporter.class.php
r318 r380 3 3 * @package testapp 4 4 * @subpackage unittest 5 * @version $Id$6 5 * @author Jouanneau Laurent 7 6 * @contributor 8 * @copyright 2005-200 6Jouanneau laurent7 * @copyright 2005-2007 Jouanneau laurent 9 8 * @link http://www.jelix.org 10 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 13 12 14 13 require_once(LIB_PATH.'/simpletest/reporter.php'); 14 require_once(LIB_PATH.'diff/diffhtml.php'); 15 15 16 16 class jHtmlRespReporter extends SimpleReporter { … … 62 62 function paintException($message) { 63 63 parent::paintException($message); 64 $str= "<span class=\" fail\">Exception</span>: ";64 $str= "<span class=\"exception\">Exception</span>: "; 65 65 $breadcrumb = $this->getTestList(); 66 66 array_shift($breadcrumb); … … 88 88 } 89 89 90 function paintDiff($stringA, $stringB){ 91 $diff = new Diff(explode("\n",$stringA),explode("\n",$stringB)); 92 if($diff->isEmpty()) { 93 $this->_response->body->append('MAIN','<p>Erreur diff : bizarre, aucune diff�nce d\'apr�la difflib...</p>'); 94 }else{ 95 $fmt = new HtmlUnifiedDiffFormatter(); 96 $this->_response->body->append('MAIN',$fmt->format($diff)); 97 } 98 } 99 90 100 function _htmlEntities($message) { 91 101 global $gJConfig; trunk/testapp/modules/unittest/classes/junittestcase.class.php
r372 r380 3 3 * @package testapp 4 4 * @subpackage unittest 5 * @version $Id$6 5 * @author Jouanneau Laurent 7 6 * @contributor 8 * @copyright 2006 Jouanneau laurent7 * @copyright 2006-2007 Jouanneau laurent 9 8 * @link http://www.jelix.org 10 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 13 12 class jUnitTestCase extends UnitTestCase { 14 13 14 /** 15 * show difference between two strings 16 * @param string $stringA the first string 17 * @param string $stringB the second string 18 * @param string $message Message to send. 19 * @access public 20 */ 21 function diff($stringA, $stringB, $message='') { 22 if (! isset($this->_reporter)) { 23 trigger_error('Can only show diff within test methods'); 24 } 25 if($message != '') 26 $this->_reporter->paintMessage($message); 27 $this->_reporter->paintDiff($stringA, $stringB); 28 } 29 30 function assertEqualOrDiff($first, $second, $message = "%s"){ 31 $ret = $this->assertEqual($first, $second, $message); 32 if(!$ret && is_string($first) && is_string($second)) 33 $this->diff($first, $second); 34 return $ret; 35 } 15 36 16 37 function assertComplexIdentical($value, $file, $errormessage=''){ trunk/testapp/modules/unittest/classes/unittestservice.class.php
r371 r380 77 77 $test->run(new jHtmlRespReporter($this->_rep)); 78 78 } 79 80 function jtplExprTest(){ 81 $test = jClasses::create("utjtplexpr"); 82 $test->run(new jHtmlRespReporter($this->_rep)); 83 } 79 84 } 80 85 ?> trunk/testapp/modules/unittest/templates/menu.tpl
r371 r380 7 7 <ul> 8 8 <li><a href="{jurl 'unittest~testselectoract'}">selecteurs d'action</a></li> <!--?module=unittest&action=testselectoract--> 9 <li><a href="?module=unittest&action=testlocaleprop">lecture .properties</a></li> 10 11 {if $isurlsig} 12 <li>test urls : 13 <a href="{jurl 'unittest~urlsig_url1',array('annee'=>'2006','mois'=>'10','id'=>'01')}">url1</a> 14 <a href="{jurl 'unittest~urlsig_url9',array('annee'=>'2006','mois'=>'10','id'=>'09')}">url9</a> 15 <a href="{jurl 'unittest~urlsig_url10',array('annee'=>'2006','mois'=>'10','id'=>'10')}">url10</a> 16 <a href="{jurl 'unittest~urlsig_url3',array('rubrique'=>'voiture','id_art'=>'54','article'=>'dodge viper')}">url3</a> 17 <a href="{jurl 'unittest~urlsig_url2',array('annee'=>'2005','mois'=>'7')}">url2</a> 18 <a href="{jurl 'unittest~urlsig_url4',array('first'=>'premier parametre','second'=>'toto le rigolo')}">url4</a> 19 </li>{/if} 9 20 </ul> 21 10 22 <h3>jEvent</h3> 11 23 <ul> … … 19 31 </ul> 20 32 21 <h3>j Locale</h3>33 <h3>jTpl</h3> 22 34 <ul> 23 <li><a href="?module=unittest&action=t estlocaleprop">Tester la lecture des properties</a></li>35 <li><a href="?module=unittest&action=tpl_parseExpression">expressions</a></li> 24 36 </ul> 25 37 26 {if $isurlsig}27 <p>test urls :28 <a href="{jurl 'unittest~urlsig_url1',array('annee'=>'2006','mois'=>'10','id'=>'01')}">url1</a>29 <a href="{jurl 'unittest~urlsig_url9',array('annee'=>'2006','mois'=>'10','id'=>'09')}">url9</a>30 <a href="{jurl 'unittest~urlsig_url10',array('annee'=>'2006','mois'=>'10','id'=>'10')}">url10</a>31 <a href="{jurl 'unittest~urlsig_url3',array('rubrique'=>'voiture','id_art'=>'54','article'=>'dodge viper')}">url3</a>32 <a href="{jurl 'unittest~urlsig_url2',array('annee'=>'2005','mois'=>'7')}">url2</a>33 <a href="{jurl 'unittest~urlsig_url4',array('first'=>'premier parametre','second'=>'toto le rigolo')}">url4</a>34 </p>{/if}35 38 <h3>jDao</h3> 36 39 <ul> trunk/testapp/www/design/screen.css
r127 r380 68 68 } 69 69 70 div.exception { margin-top:4px; margin-bottom:4px; 71 background-color: #ff9186; 72 border: 1px solid red; } 70 73 74 div.exception strong {color: red;} 75 div.exception p { font-size:0.9em; } 71 76 72 77 .diff { background: white; border: 1px solid black; } 78 .diff .block { background: #ccc; padding-left: 1em; } 79 .diff .context { background: white; border: none; } 80 .diff .block tt { font-weight: normal; font-family: monospace; color: black; 81 margin-left: 0; border: none; } 82 .diff del, .diff ins { font-weight: bold; text-decoration: none; } 83 .diff .original, .diff .deleted, 84 .diff .final, .diff .added { background: white; } 85 .diff .original, .diff .deleted { background: #fcc; border: none; } 86 .diff .final, .diff .added { background: #cfc; border: none; } 87 .diff del { background: #f99; } 88 .diff ins { background: #9f9; } 73 89 74 90
