public function testShouldSetCustomParamAfterWildcard() { $path = dirname(__FILE__) . '/apps/sample/'; $dispatcher = new Net_URL_Dispatcher(__METHOD__); $_ENV['PATH_INFO'] = 'hoge/customparams/name/foo/1'; ob_start(); $dispatcher->connect(':controller/:action/*params/:id')->dispatch($path); $buffer = ob_get_contents(); ob_end_clean(); $this->assertSame($buffer, 'id=1, name=foo'); }
public function testShouldDispatchToAnotherSubDirectory() { $path = dirname(dirname(__FILE__)) . '/apps/sample/'; $dispatcher = new Net_URL_Dispatcher(__METHOD__); $dispatcher->setActionDirectoryName('others/Sub'); $_ENV['PATH_INFO'] = 'bar'; ob_start(); $dispatcher->connect(':action')->dispatch($path); $buffer = ob_get_contents(); ob_end_clean(); $this->assertSame($buffer, 'BarAction_execute'); }
public function testShouldDispatchToAnotherSubDirectory() { $path = dirname(dirname(__FILE__)) . '/apps/sample/'; $dispatcher = new Net_URL_Dispatcher(__METHOD__); $dispatcher->setControllerDirectoryName('others/Sub'); $_ENV['PATH_INFO'] = '/bar/index'; ob_start(); $dispatcher->connect(':controller/:action/*params')->dispatch($path); $buffer = ob_get_contents(); ob_end_clean(); $this->assertSame($buffer, 'BarController_indexAction'); }