Changeset 390
- Timestamp:
- 03/23/07 12:33:15 (2 years ago)
- Files:
-
- trunk/build/manifests/testapp.mn (modified) (1 diff)
- trunk/ext/jelix/jelix.c (modified) (3 diffs)
- trunk/lib/jelix/core/jSelector.class.php (modified) (5 diffs)
- trunk/testapp/modules/unittest/classes/unittestservice.class.php (modified) (1 diff)
- trunk/testapp/modules/unittest/classes/utselectoract.class.php (modified) (1 diff)
- trunk/testapp/modules/unittest/classes/utselectormod.class.php (added)
- trunk/testapp/modules/unittest/controllers/default.classic.php (modified) (1 diff)
- trunk/testapp/modules/unittest/templates/menu.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/testapp.mn
r380 r390 68 68 utparseurls.class.php 69 69 utselectoract.class.php 70 utselectormod.class.php 70 71 utsimpletest.class.php 71 72 utdao.class.php trunk/ext/jelix/jelix.c
r389 r390 607 607 char *r; 608 608 int ld = sizeof("default_") -1; 609 int lr = ld + resource_length +1;610 r= emalloc(lr );609 int lr = ld + resource_length; 610 r= emalloc(lr+1); 611 611 if (r) { 612 612 memcpy(r, "default_", ld); 613 613 memcpy(r+ld, resource, resource_length); 614 614 r[lr] = 0; 615 zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "resource", sizeof("resource") - 1, r, lr -1TSRMLS_CC);615 zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "resource", sizeof("resource") - 1, r, lr TSRMLS_CC); 616 616 efree(r); 617 617 } … … 623 623 char *r; 624 624 int ld = sizeof("default") -1; 625 int lr = ld + resource_length + 1;626 r= emalloc(lr );625 int lr = ld + resource_length; 626 r= emalloc(lr+1); 627 627 if (r) { 628 628 memcpy(r, "default", ld); 629 629 memcpy(r+ld, resource, resource_length); 630 630 r[lr] = 0; 631 zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "resource", sizeof("resource") - 1, r, lr -1TSRMLS_CC);631 zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "resource", sizeof("resource") - 1, r, lr TSRMLS_CC); 632 632 efree(r); 633 633 } … … 638 638 char *r; 639 639 int ld = sizeof("index") -1; 640 int lr = ld + resource_length +1;641 r= emalloc(lr );640 int lr = resource_length + ld; 641 r= emalloc(lr+1); 642 642 if (r) { 643 643 memcpy(r, resource, resource_length); 644 644 memcpy(r+resource_length, "index", ld); 645 645 r[lr] = 0; 646 zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "resource", sizeof("resource") - 1, r, lr -1TSRMLS_CC);646 zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "resource", sizeof("resource") - 1, r, lr TSRMLS_CC); 647 647 efree(r); 648 648 } trunk/lib/jelix/core/jSelector.class.php
r386 r390 103 103 104 104 function __construct($sel){ 105 if(preg_match("/^(([\w\.]+)~)?([\w\.]+)$/", $sel, $m)){ 105 #if ENABLE_PHP_JELIX 106 if(jelix_scan_module_sel($sel, $this)){ 107 if($this->module ==''){ 108 $this->module = jContext::get (); 109 } 110 #else 111 if(preg_match("/^(([a-zA-Z0-9_\.]+)~)?([a-zA-Z0-9_\.]+)$/", $sel, $m)){ 106 112 if($m[1]!='' && $m[2]!=''){ 107 113 $this->module = $m[2]; … … 110 116 } 111 117 $this->resource = $m[3]; 118 #endif 112 119 $this->_createPath(); 113 120 $this->_createCachePath(); … … 190 197 global $gJCoord; 191 198 192 if(preg_match("/^(?:([\w\.]+|\#)~)?([\w\.]+|\#)?(?:@([\w\.]+))?$/", $sel, $m)){ 199 #if ENABLE_PHP_JELIX 200 jLog::log("sel : ".$sel." (".$gJCoord->actionName.")"); 201 if(jelix_scan_action_sel($sel, $this, $gJCoord->actionName)){ 202 if($this->module == '#'){ 203 $this->module = $gJCoord->moduleName; 204 }elseif($this->module ==''){ 205 $this->module = jContext::get (); 206 } 207 208 if($this->request == '') 209 $this->request = $gJCoord->request->type; 210 211 #else 212 if(preg_match("/^(?:([a-zA-Z0-9_\.]+|\#)~)?([a-zA-Z0-9_]+|\#)?(?:@([a-zA-Z0-9_]+))?$/", $sel, $m)){ 193 213 $m=array_pad($m,4,''); 194 214 if($m[1]!=''){ … … 219 239 else 220 240 $this->request = $gJCoord->request->type; 221 241 #endif 222 242 $this->_createPath(); 223 243 }else{ … … 316 336 $this->_compilerPath=JELIX_LIB_CORE_PATH.'jLocalesCompiler.class.php'; 317 337 318 if(preg_match("/^(([ \w\.]+)~)?(\w+)\.([\w\.]+)$/", $sel, $m)){338 if(preg_match("/^(([a-zA-Z0-9_\.]+)~)?([a-zA-Z0-9_]+)\.([a-zA-Z0-9_\.]+)$/", $sel, $m)){ 319 339 if($m[1]!='' && $m[2]!=''){ 320 340 $this->module = $m[2]; trunk/testapp/modules/unittest/classes/unittestservice.class.php
r380 r390 45 45 $test->run(new jHtmlRespReporter($this->_rep)); 46 46 } 47 function selectorModTest(){ 48 $test = jClasses::create("utselectormod"); 49 $test->run(new jHtmlRespReporter($this->_rep)); 50 } 47 51 48 52 function daoConditionsTest(){ trunk/testapp/modules/unittest/classes/utselectoract.class.php
r389 r390 121 121 } 122 122 123 $this->assertTrue($ok , ' test de '.$sel );123 $this->assertTrue($ok , ' test de '.$sel. ' (devrait ĂȘtre '.($res === false ? 'invalide':'valide').')'); 124 124 if($msg) 125 125 $this->sendMessage($msg); trunk/testapp/modules/unittest/controllers/default.classic.php
r386 r390 66 66 return $rep; 67 67 } 68 function testselectormod(){ 69 $rep = $this->getResponse('unittest'); 70 $rep->title = 'test unitaires sur les selecteurs normaux'; 71 72 $ut = jClasses::create("unittestservice"); 73 $ut->init($rep); 74 $ut->selectorModTest(); 75 return $rep; 76 } 68 77 69 78 trunk/testapp/modules/unittest/templates/menu.tpl
r386 r390 6 6 <h3>Core</h3> 7 7 <ul> 8 <li><a href="{jurl 'unittest~testselectoract'}">selecteurs d'action</a></li> <!--?module=unittest&action=testselectoract--> 8 <li><a href="?module=unittest&action=default_testselectormod">selecteurs normaux</a></li> <!--{jurl 'unittest~testselectormod'} --> 9 <li><a href="?module=unittest&action=testselectoract">selecteurs d'action</a></li> <!--{jurl 'unittest~default_testselectoract'} --> 9 10 <li><a href="?module=unittest&action=testlocaleprop">lecture .properties</a></li> 10 11
