Changeset 69
- Timestamp:
- 02/02/06 01:38:13 (3 years ago)
- Files:
-
- trunk/lib/jelix/core/url/jUrlEngine.significant.class.php (modified) (1 diff)
- trunk/lib/jelix/core/url/jUrlEngine.simple.class.php (modified) (2 diffs)
- trunk/lib/simpletest/runner.php (modified) (1 diff)
- trunk/lib/simpletest/simple_test.php (modified) (1 diff)
- trunk/myapp/var/config/config.classic.ini.php.dist (modified) (1 diff)
- trunk/testapp/modules/testapp/actiongroups/main.ag.php (modified) (1 diff)
- trunk/testapp/modules/unittest/actiongroups/default.ag.php (modified) (1 diff)
- trunk/testapp/modules/unittest/actiongroups/urlsig.ag.php (added)
- trunk/testapp/modules/unittest/actions.xml (modified) (1 diff)
- trunk/testapp/modules/unittest/classes/jhtmlrespreporter.class.php (added)
- trunk/testapp/modules/unittest/classes/unittestservice.class.php (modified) (3 diffs)
- trunk/testapp/modules/unittest/classes/utcreateurls.class.php (added)
- trunk/testapp/modules/unittest/classes/utevents.class.php (modified) (2 diffs)
- trunk/testapp/modules/unittest/templates/accueil.tpl (modified) (1 diff)
- trunk/testapp/var/config/urls.xml (modified) (1 diff)
- trunk/testapp/www/unittest.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix/core/url/jUrlEngine.significant.class.php
r66 r69 198 198 199 199 $url->scriptName = $urlinfo[1]; 200 200 if(!$GLOBALS['gJConfig']->urlengine['multiview_on']){ 201 $script.=$GLOBALS['gJConfig']->urlengine['entrypoint_extension']; 202 } 201 203 if($urlinfo[0]==0){ 202 204 $cl = $urlinfo[1]; trunk/lib/jelix/core/url/jUrlEngine.simple.class.php
r51 r69 25 25 } 26 26 27 protected function getScript($requestType, $module=null, $action=null , $nosuffix=false){27 protected function getScript($requestType, $module=null, $action=null){ 28 28 static $urlspe = null; 29 29 global $gJConfig; … … 41 41 } 42 42 } 43 44 43 $found = false; 45 46 if($action && $action !='' && isset($sep[$module.'~'.$action.'@'.$requestType])){ 47 $script = $sep[$module.'~'.$action.'@'.$requestType]; 44 if($action && $action !='' && isset($urlspe[$module.'~'.$action.'@'.$requestType])){ 45 $script = $urlspe[$module.'~'.$action.'@'.$requestType]; 48 46 $found = true; 49 47 } 50 51 if($module && $module !='' && !$found && isset($sep[$module.'~*@'.$requestType])){ 52 $script = $sep[$module.'~*@'.$requestType]; 48 if($module && $module !='' && !$found && isset($urlspe[$module.'~*@'.$requestType])){ 49 $script = $urlspe[$module.'~*@'.$requestType]; 53 50 $found = true; 54 51 } 55 56 if(!$found && isset($sep['@'.$requestType])){ 57 $script = $sep['@'.$requestType]; 52 if(!$found && isset($urlspe['@'.$requestType])){ 53 $script = $urlspe['@'.$requestType]; 58 54 $found = true; 59 55 } 60 56 } 61 62 if(!$nosuffix && !$gJConfig->urlengine['multiview_on']){ 57 if(!$gJConfig->urlengine['multiview_on']){ 63 58 $script.=$gJConfig->urlengine['entrypoint_extension']; 64 59 } trunk/lib/simpletest/runner.php
r67 r69 183 183 $invoker->invoke($method); 184 184 } 185 185 186 $this->_scorer->paintMethodEnd($method); 186 187 } trunk/lib/simpletest/simple_test.php
r67 r69 84 84 function run(&$reporter) { 85 85 $reporter->paintCaseStart($this->getLabel()); 86 $this->_runner = & $this->_createRunner($reporter);86 $this->_runner = & $this->_createRunner($reporter); 87 87 $this->_runner->run(); 88 88 $reporter->paintCaseEnd($this->getLabel()); trunk/myapp/var/config/config.classic.ini.php.dist
r60 r69 89 89 xmlrpc = "@xmlrpc" 90 90 jsonrpc = "@jsonrpc" 91 92 93 [logfiles] 94 default=messages.log trunk/testapp/modules/testapp/actiongroups/main.ag.php
r65 r69 26 26 $rep->body->assign('value','name'); 27 27 } 28 28 29 return $rep; 29 30 } trunk/testapp/modules/unittest/actiongroups/default.ag.php
r67 r69 34 34 } 35 35 36 function getTestCreate(){ 37 $rep = $this->getResponse('default'); 38 $rep->title = 'test unitaires sur la creation d\'url avec jUrl'; 36 39 40 $ut = jClasses::create("unittestservice"); 41 $ut->init($rep); 42 $ut->urlsTest(); 43 44 return $rep; 45 } 37 46 } 38 47 ?> trunk/testapp/modules/unittest/actions.xml
r67 r69 11 11 </action> 12 12 13 <action name="urlsigparse" ag=" urlsig" method="getTestParsing" >13 <action name="urlsigparse" ag="default" method="getTestParsing" > 14 14 <response default="true" name="default" type="unittest" /> 15 15 </action> 16 16 17 <action name="urlsigcreate" ag=" urlsig" method="getTestCreate" >17 <action name="urlsigcreate" ag="default" method="getTestCreate" > 18 18 <response default="true" name="default" type="unittest" /> 19 19 </action> trunk/testapp/modules/unittest/classes/unittestservice.class.php
r67 r69 1 1 <?php 2 /** 3 * @package testapp 4 * @subpackage unittest module 5 * @version $Id$ 6 * @author Jouanneau Laurent 7 * @contributor 8 * @copyright 2006 Jouanneau laurent 9 * @link http://www.jelix.org 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 11 */ 2 12 3 13 require_once(LIB_PATH.'/simpletest/unit_tester.php'); 4 require_once( LIB_PATH.'/simpletest/reporter.php');14 require_once(dirname(__FILE__).'/jhtmlrespreporter.class.php'); 5 15 6 class jHtmlRepReporter extends SimpleReporter {7 protected $_response;8 function __construct($response) {9 $this->SimpleReporter();10 $this->_response = $response;11 }12 13 function paintHeader($test_name) {14 $this->_response->title=$test_name;15 $this->_response->body->append('MAIN','<h2>'.$test_name.'</h2>');16 }17 18 function paintFooter($test_name) {19 $colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "resultfail" : "resultsuccess");20 $str = "<div class=\"$colour\">";21 $str.= $this->getTestCaseProgress() . "/" . $this->getTestCaseCount();22 $str.= " test cases complete:\n";23 $str.= "<strong>" . $this->getPassCount() . "</strong> passes, ";24 $str.= "<strong>" . $this->getFailCount() . "</strong> fails and ";25 $str.= "<strong>" . $this->getExceptionCount() . "</strong> exceptions.";26 $str.= "</div>\n";27 $this->_response->body->append('MAIN',$str);28 }29 30 function paintFail($message) {31 parent::paintFail($message);32 33 $str = "<span class=\"fail\">Fail</span>: ";34 $breadcrumb = $this->getTestList();35 array_shift($breadcrumb);36 $str.= implode(" -> ", $breadcrumb);37 $str.= " -> " . $this->_htmlEntities($message) . "<br />\n";38 $this->_response->body->append('MAIN',$str);39 }40 41 function paintException($message) {42 parent::paintException($message);43 $str= "<span class=\"fail\">Exception</span>: ";44 $breadcrumb = $this->getTestList();45 array_shift($breadcrumb);46 $str.= implode(" -> ", $breadcrumb);47 $str.= " -> <strong>" . $this->_htmlEntities($message) . "</strong><br />\n";48 $this->_response->body->append('MAIN',$str);49 }50 51 function paintMessage($message) {52 $this->_response->body->append('MAIN','<p>'.$message.'</p>');53 }54 55 function paintFormattedMessage($message) {56 $this->_response->body->append('MAIN','<pre>' . $this->_htmlEntities($message) . '</pre>');57 }58 59 function _htmlEntities($message) {60 return htmlentities($message, ENT_COMPAT, $this->_character_set);61 }62 }63 16 64 17 … … 72 25 73 26 $test = jClasses::create("utevents"); 74 $test->run(new jHtmlRe pReporter($this->_rep));27 $test->run(new jHtmlRespReporter($this->_rep)); 75 28 } 76 29 /*$test = &new GroupTest('All tests'); … … 78 31 $test->run(new HtmlReporter()); 79 32 */ 33 34 function urlsTest(){ 35 $test = jClasses::create("utcreateurls"); 36 $test->run(new jHtmlRespReporter($this->_rep)); 37 } 80 38 } 81 39 ?> trunk/testapp/modules/unittest/classes/utevents.class.php
r67 r69 1 1 <?php 2 /** 3 * @package testapp 4 * @subpackage unittest module 5 * @version $Id$ 6 * @author Jouanneau Laurent 7 * @contributor 8 * @copyright 2006 Jouanneau laurent 9 * @link http://www.jelix.org 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 11 */ 2 12 3 13 class UTEvents extends UnitTestCase { 4 14 5 15 function testEvents() { 6 $this->sendMessage("�nement simple");7 16 $response = jEvent::notify('TestEvent'); 8 17 $response = $response->getResponse (); … … 10 19 $temoin = serialize(array('module'=>'unittest','ok'=>true)); 11 20 12 $this->assertTrue($temoin == $response, ' Premier ev�ment');21 $this->assertTrue($temoin == $response, '�nement simple'); 13 22 14 $this->sendMessage("�nement avec param�es");15 23 $temoin = array('hello'=>'world'); 16 24 $response = jEvent::notify('TestEventWithParams',$temoin ); 17 25 $response = $response->getResponse (); 18 26 19 $this->assertTrue(($response[0]['params'] == 'world'), ' Deuxi� ev�ment');27 $this->assertTrue(($response[0]['params'] == 'world'), '�nement avec param�es'); 20 28 } 21 29 } trunk/testapp/modules/unittest/templates/accueil.tpl
r67 r69 9 9 10 10 </ul> 11 <!-- 11 12 12 <h3>jUrl</h3> 13 13 <ul> 14 14 <li><a href="?module=unittest&action=urlsigcreate">Tester la cr�ion d'url</a></li> 15 <li><a href="?module=unittest&action=urlsigparse">Tester l'analyse d'url</a></li>15 <!-- <li><a href="?module=unittest&action=urlsigparse">Tester l'analyse d'url</a></li>--> 16 16 </ul> 17 --> 17 18 18 </div> 19 19 trunk/testapp/var/config/urls.xml
r53 r69 2 2 <urls xmlns="http://jelix.org/ns/urls/1.0"> 3 3 <classicentrypoint name="index" default="true"> 4 <url pathinfo="/test/:annee/:mois" module="testapp" action="test1">4 <url pathinfo="/test/:annee/:mois" module="testapp" action="test1"> 5 5 <param name="annee" escape="true" regexp="\d{4}"/> 6 6 <param name="mois" escape="false" /> 7 7 <static name="bla" value="cequejeveux" /> 8 8 </url> 9 <!--<url handler="foo" module="testapp" />--> 9 10 <url pathinfo="/test/news/:annee/:mois/:id" module="unittest" action="url1"> 11 <param name="annee" regexp="\d{4}"/> 12 <param name="mois" regexp="\d{2}" /> 13 <param name="id" regexp="\d{2}" /> 14 </url> 15 16 <url pathinfo="/test/cms/:rubrique/:id_art-:article" module="unittest" action="url3"> 17 <param name="rubrique" /> 18 <param name="id_art" regexp="\d+"/> 19 <param name="article" escape="true"/> 20 </url> 21 10 22 </classicentrypoint> 23 <classicentrypoint name="testnews"> 24 <url pathinfo="/:annee/:mois" module="unittest" action="url2"> 25 <param name="annee" regexp="\d{4}"/> 26 <param name="mois" regexp="\d{2}" /> 27 <static name="mystatic" value="valeur statique" /> 28 </url> 29 </classicentrypoint> 30 <classicentrypoint name="foo/bar"> 31 <url handler="urlfoo" module="unittest" action="url4" /> 32 </classicentrypoint> 33 11 34 <classicentrypoint name="news"> 12 35 <url module="news" /> trunk/testapp/www/unittest.css
r67 r69 32 32 33 33 .fail { color: red; } 34 .pass { color: green; } 34 35 pre { background-color: lightgray; } 35 36
