コード例 #1
0
ファイル: regexp.php プロジェクト: jacomyma/GEXF-Atlas
 public function testsMatchComplex()
 {
     $route = new ezcMvcRegexpRoute('@^people(/((?P<nr>[0-9]+)|(?P<name>.+)))?$@', 'testController', 'action', array('nr' => '', 'name' => ''));
     $request = new ezcMvcRequest();
     $request->uri = 'people/hawking';
     $routeInfo = $route->matches($request);
     self::assertSame('testController', $routeInfo->controllerClass);
     self::assertEquals(array('nr' => '', 'name' => 'hawking'), $request->variables);
     $request = new ezcMvcRequest();
     $request->uri = 'people/42';
     $routeInfo = $route->matches($request);
     self::assertSame('testController', $routeInfo->controllerClass);
     self::assertEquals(array('nr' => '42', 'name' => ''), $request->variables);
     $request = new ezcMvcRequest();
     $request->uri = 'people';
     $routeInfo = $route->matches($request);
     self::assertSame('testController', $routeInfo->controllerClass);
     self::assertEquals(array('nr' => '', 'name' => ''), $request->variables);
     $request = new ezcMvcRequest();
     $request->uri = 'people/';
     $routeInfo = $route->matches($request);
     self::assertEquals(null, $routeInfo);
 }