Development

Changeset 4255

You must first sign up to be able to contribute.

Changeset 4255

Show
Ignore:
Timestamp:
06/19/07 00:16:46 (1 year ago)
Author:
dwhittle
Message:

dwhittle: merged trunk/routing changes to branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dwhittle/CHANGELOG

    r4232 r4255  
    1414* Refactored sfRouting::connect() 
    1515* 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: 
    1717    url: /:module/:action|:foo.:format 
    1818* r3742: added sfAction::renderPartial() method 
  • branches/dwhittle/lib/controller/sfRouting.class.php

    r4234 r4255  
    311311    else 
    312312    { 
    313       preg_match_all('/[:$]([\w\d\-_]+)/', $route, $matches); 
     313      preg_match_all('/[:$]([\w\d_]+)/', $route, $matches); 
    314314 
    315315      $tokens    = $matches[0]; 
  • branches/dwhittle/lib/generator/sfCrudGenerator.class.php

    r3688 r4255  
    345345    if ($column->isForeignKey()) 
    346346    { 
    347       if (!$column->isNotNull()
     347      if (!$column->isNotNull() && !isset($params['include_blank'])
    348348      { 
    349349        $params['include_blank'] = true; 
    350350      } 
     351 
    351352      return $this->getPHPObjectHelper('select_tag', $column, $params, array('related_class' => $this->getRelatedClassName($column))); 
    352353    } 
  • branches/dwhittle/test/functional/backend/customizationTest.php

    r4249 r4255  
    131131  checkResponseElement('label[for="article_id"]', false)-> 
    132132  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) 
    134147; 
  • branches/dwhittle/test/other/fixtures/test/functional/result.txt

    r2823 r4255  
    55ok 4 - response selector body does not match regex /This is a temporary page/ 
    661..4 
     7 Looks like everything went fine.                                       
  • branches/dwhittle/test/other/fixtures/test/unit/result-harness.txt

    r2275 r4255  
    11testTest.............................................................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  
    111..1 
    22ok 1 - this is ok 
     3 Looks like everything went fine.                                       
  • branches/dwhittle/test/unit/controller/sfRoutingTest.php

    r4232 r4255  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(94, new lime_output_color()); 
     13$t = new lime_test(108, new lime_output_color()); 
    1414 
    1515// public methods 
     
    295295$t->diag('separators'); 
    296296$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'); 
    302337 
    303338// token names 
    304339$t->diag('token names'); 
    305340$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'); 
    308343$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 _'); 
    311346 
    312347// token prefix