Changeset 924

Show
Ignore:
Timestamp:
07/22/08 16:24:59 (3 months ago)
Author:
kaste
Message:

Changed naming asinitiy. ->testReciprocity() (sic) is now ->checkReciprocity().

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/kaste/PHPUnit_TestSuite/examples/RoutingTest.php

    r918 r924  
    88    function testStandardRoute() 
    99    { 
    10         $this->get('/blog/index'); 
     10        // after parametrizing the url, check if the router  
     11        // can build the same given url from these parameters  
     12        $this->checkReciprocity();  
     13         
     14        $this->get('/blog'); 
    1115        $this->assertController('blog'); 
    1216        $this->assertAction('index'); 
  • branches/kaste/PHPUnit_TestSuite/lib/PHPUnit_Routing_TestCase.php

    r918 r924  
    4646    } 
    4747     
    48     function testReciprocity($bool = true) 
     48    function checkReciprocity($bool = true) 
    4949    { 
    5050        return $this->reciprocity = $bool; 
     
    6060        try { 
    6161            $this->params = $this->Router->match($Request); 
     62            if ($this->reciprocity){ 
     63                $this->assertEquals($url, $this->Router->urlize($this->params)->path()); 
     64            } 
    6265        }catch (NoMatchingRouteException $e){ 
    6366            $this->errors = true; 
    64         } 
    65         #$this->params = $this->Router->match($url); 
    66         if ($this->reciprocity && $this->params){ 
    67             $this->assertEquals($this->encloseWithSlashes($url), $this->Router->toUrl($this->params)); 
    6867        } 
    6968        return $this; 
     
    8180                 
    8281        return $Request; 
    83     } 
    84      
    85     private function encloseWithSlashes($string) 
    86     { 
    87         return $string == '/' || $string == '' ? '/' : '/'.trim($string,'/').'/'; 
    8882    } 
    8983     
  • branches/kaste/PHPUnit_TestSuite/tests/fixtures/routes.php

    r920 r924  
    55$Map->connect('/', array('controller' => 'page', 'action' => 'index')); 
    66$Map->connect('/:artist/:album/tags',array('controller'=>'tags')); 
    7 $Map->connect('/admin/logs/:controller/:action/:id',array('module'=>'admin/logs')); 
     7$Map->connect('/admin/logs/:type',array('module'=>'admin','controller'=>'logs','action'=>'list','type'=>'all')); 
     8$Map->connect('/admin/:controller/:action/:id',array('module'=>'admin','action'=>COMPULSORY)); 
    89$Map->connect('/:controller/:action/:id', array('controller' => 'page', 'action' => 'index'),array('id'=>'\d{1,}')); 
    9 $Map->connect('/:module/:controller/:action/:id',array('action'=>COMPULSORY)); 
    1010 
    1111?> 
  • branches/kaste/PHPUnit_TestSuite/tests/lib/RoutingTest.php

    r918 r924  
    2020    function testShouldResolveToAdminModule() 
    2121    { 
    22         $this->get('/admin/user/add/'); 
     22        $this->get('/admin/user/add'); 
    2323 
    2424        $this->assertParameterEquals('admin','module'); 
     
    2929    function testRouteToAdminLogs() 
    3030    { 
    31         $this->get('/admin/logs/warnings/show/1'); 
    32         $this->assertModule('admin/logs'); 
    33         $this->assertController('warnings'); 
    34         $this->assertAction('show'); 
    35         $this->assertId(1); 
     31        $this->get('/admin/logs/warnings'); 
     32        $this->assertModule('admin'); 
     33        $this->assertController('logs'); 
     34        $this->assertAction('list'); 
     35        $this->assertParameterEquals('warnings','type'); 
    3636    } 
    3737