Changeset 4255
- Timestamp:
- 06/19/07 00:16:46 (1 year ago)
- Files:
-
- branches/dwhittle/CHANGELOG (modified) (1 diff)
- branches/dwhittle/lib/controller/sfRouting.class.php (modified) (1 diff)
- branches/dwhittle/lib/generator/sfCrudGenerator.class.php (modified) (1 diff)
- branches/dwhittle/test/functional/backend/customizationTest.php (modified) (1 diff)
- branches/dwhittle/test/other/fixtures/test/functional/result.txt (modified) (1 diff)
- branches/dwhittle/test/other/fixtures/test/unit/result-harness.txt (modified) (1 diff)
- branches/dwhittle/test/other/fixtures/test/unit/result.txt (modified) (1 diff)
- branches/dwhittle/test/unit/controller/sfRoutingTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/CHANGELOG
r4232 r4255 14 14 * Refactored sfRouting::connect() 15 15 * Cleaned up sfRoutingTest 16 * Routing rules now accept named tokens separated by ; : + | and . (in addition to the usual /), like so:16 * Routing rules now accept named tokens separated by ; : + | - and . (in addition to the usual /), like so: 17 17 url: /:module/:action|:foo.:format 18 18 * r3742: added sfAction::renderPartial() method branches/dwhittle/lib/controller/sfRouting.class.php
r4234 r4255 311 311 else 312 312 { 313 preg_match_all('/[:$]([\w\d \-_]+)/', $route, $matches);313 preg_match_all('/[:$]([\w\d_]+)/', $route, $matches); 314 314 315 315 $tokens = $matches[0]; branches/dwhittle/lib/generator/sfCrudGenerator.class.php
r3688 r4255 345 345 if ($column->isForeignKey()) 346 346 { 347 if (!$column->isNotNull() )347 if (!$column->isNotNull() && !isset($params['include_blank'])) 348 348 { 349 349 $params['include_blank'] = true; 350 350 } 351 351 352 return $this->getPHPObjectHelper('select_tag', $column, $params, array('related_class' => $this->getRelatedClassName($column))); 352 353 } branches/dwhittle/test/functional/backend/customizationTest.php
r4249 r4255 131 131 checkResponseElement('label[for="article_id"]', false)-> 132 132 checkResponseElement('label[for="article_category_id"]', true)-> 133 checkResponseElement('label[for="article_created_at"]', true) 133 checkResponseElement('label[for="article_created_at"]', true)-> 134 135 // check foreign key select box customization 136 checkEditCustomization('foreign key select customization', array())-> 137 checkResponseElement('#article_book_id > option[value=""]', true)-> 138 139 checkEditCustomization('foreign key select customization', array('fields' => array('book_id' => array('params' => 'include_blank=false'))))-> 140 checkResponseElement('#article_book_id > option[value=""]', false)-> 141 142 checkEditCustomization('foreign key select customization', array('fields' => array('book_id' => array('params' => 'include_blank=true'))))-> 143 checkResponseElement('#article_book_id > option[value=""]', true)-> 144 145 checkEditCustomization('foreign key select customization', array('fields' => array('book_id' => array('params' => 'include_custom=--custom-- include_blank=false'))))-> 146 checkResponseElement('#article_book_id > option[value=""]', 1) 134 147 ; branches/dwhittle/test/other/fixtures/test/functional/result.txt
r2823 r4255 5 5 ok 4 - response selector body does not match regex /This is a temporary page/ 6 6 1..4 7 Looks like everything went fine. branches/dwhittle/test/other/fixtures/test/unit/result-harness.txt
r2275 r4255 1 1 testTest.............................................................ok 2 All tests successful. 3 Files=1, Tests=1 2 All tests successful. 3 Files=1, Tests=1 branches/dwhittle/test/other/fixtures/test/unit/result.txt
r2275 r4255 1 1 1..1 2 2 ok 1 - this is ok 3 Looks like everything went fine. branches/dwhittle/test/unit/controller/sfRoutingTest.php
r4232 r4255 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 94, new lime_output_color());13 $t = new lime_test(108, new lime_output_color()); 14 14 15 15 // public methods … … 295 295 $t->diag('separators'); 296 296 $r->clearRoutes(); 297 $r->connect('test1', '/:module/:action;:foo::baz+:toto|:zozo.:format', array()); 298 $params = array('module' => 'default', 'action' => 'foobar', 'foo' => 'bar', 'baz' => 'baz', 'toto' => 'titi', 'zozo' => 'zaza', 'format' => 'xml'); 299 $url = '/default/foobar;bar:baz+titi|zaza.xml'; 300 $t->is($r->parse($url), $params, '->parse() accepts / ; : + | and . as separators'); 301 $t->is($r->generate('', $params), $url, '->generate() creates routes with / ; : + | and . separators'); 297 $r->connect('test', '/:module/:action;:foo::baz+:toto|:hip-:zozo.:format', array()); 298 $r->connect('test0', '/:module/:action0', array()); 299 $r->connect('test1', '/:module;:action1', array()); 300 $r->connect('test2', '/:module::action2', array()); 301 $r->connect('test3', '/:module+:action3', array()); 302 $r->connect('test4', '/:module|:action4', array()); 303 $r->connect('test5', '/:module.:action5', array()); 304 $r->connect('test6', '/:module-:action6', array()); 305 $params = array('module' => 'default', 'action0' => 'foobar'); 306 $url = '/default/foobar'; 307 $t->is($r->parse($url), $params, '->parse() recognizes parameters separated by /'); 308 $t->is($r->generate('', $params), $url, '->generate() creates routes with / separator'); 309 $params = array('module' => 'default', 'action1' => 'foobar'); 310 $url = '/default;foobar'; 311 $t->is($r->parse($url), $params, '->parse() recognizes parameters separated by ;'); 312 $t->is($r->generate('', $params), $url, '->generate() creates routes with ; separator'); 313 $params = array('module' => 'default', 'action2' => 'foobar'); 314 $url = '/default:foobar'; 315 $t->is($r->parse($url), $params, '->parse() recognizes parameters separated by :'); 316 $t->is($r->generate('', $params), $url, '->generate() creates routes with : separator'); 317 $params = array('module' => 'default', 'action3' => 'foobar'); 318 $url = '/default+foobar'; 319 $t->is($r->parse($url), $params, '->parse() recognizes parameters separated by +'); 320 $t->is($r->generate('', $params), $url, '->generate() creates routes with + separator'); 321 $params = array('module' => 'default', 'action4' => 'foobar'); 322 $url = '/default|foobar'; 323 $t->is($r->parse($url), $params, '->parse() recognizes parameters separated by |'); 324 $t->is($r->generate('', $params), $url, '->generate() creates routes with | separator'); 325 $params = array('module' => 'default', 'action5' => 'foobar'); 326 $url = '/default.foobar'; 327 $t->is($r->parse($url), $params, '->parse() recognizes parameters separated by .'); 328 $t->is($r->generate('', $params), $url, '->generate() creates routes with . separator'); 329 $params = array('module' => 'default', 'action6' => 'foobar'); 330 $url = '/default-foobar'; 331 $t->is($r->parse($url), $params, '->parse() recognizes parameters separated by -'); 332 $t->is($r->generate('', $params), $url, '->generate() creates routes with - separator'); 333 $params = array('module' => 'default', 'action' => 'foobar', 'foo' => 'bar', 'baz' => 'baz', 'toto' => 'titi', 'hip' => 'hop', 'zozo' => 'zaza', 'format' => 'xml'); 334 $url = '/default/foobar;bar:baz+titi|hop-zaza.xml'; 335 $t->is($r->parse($url), $params, '->parse() recognizes parameters separated by mixed separators'); 336 $t->is($r->generate('', $params), $url, '->generate() creates routes with mixed separators'); 302 337 303 338 // token names 304 339 $t->diag('token names'); 305 340 $r->clearRoutes(); 306 $r->connect('test1', '/:foo_1/:bar -2', array());307 $params = array('foo_1' => 'test', 'bar -2' => 'foobar');341 $r->connect('test1', '/:foo_1/:bar2', array()); 342 $params = array('foo_1' => 'test', 'bar2' => 'foobar'); 308 343 $url = '/test/foobar'; 309 $t->is($r->parse($url), $params, '->parse() accepts token names including _ and -');310 $t->is($r->generate('', $params), $url, '->generate() accepts token names including _ and -');344 $t->is($r->parse($url), $params, '->parse() accepts token names composed of letters, digits and _'); 345 $t->is($r->generate('', $params), $url, '->generate() accepts token names composed of letters, digits and _'); 311 346 312 347 // token prefix