Exemplo n.º 1
0
 function testNamedRoutesMissingArgument()
 {
     $request = new ezcMvcRequest();
     $request->uri = 'entry/get/89';
     $router = new testNamedRouter($request);
     try {
         $router->generateUrl('info', array());
         self::fail("Expected exception not thrown.");
     } catch (ezcMvcMissingRouteArgumentException $e) {
         self::assertEquals("The argument 'id' was not specified while generating a URL out of the route with pattern 'entry/:id/info'.", $e->getMessage());
     }
     try {
         $router->generateUrl('multiple1', array('person' => 'derick'));
     } catch (ezcMvcMissingRouteArgumentException $e) {
         self::assertEquals("The argument 'relation' was not specified while generating a URL out of the route with pattern 'e/:person/:relation'.", $e->getMessage());
     }
 }
Exemplo n.º 2
0
 function testNamedRouteThatDoesNotSupportReversedRoutes()
 {
     $request = new ezcMvcRequest();
     $request->uri = 'entry/get/89';
     $router = new testNamedRouter($request);
     try {
         $foo = $router->generateUrl('no-reverse');
         self::fail('Expected exception not thrown.');
     } catch (ezcMvcNamedRouteNotReversableException $e) {
         self::assertEquals("The route with name 'no-reverse' is of the 'testRegexpRoute' class, which does not support reversed route generation.", $e->getMessage());
     }
     try {
         $foo = $router->generateUrl('catchall');
         self::fail('Expected exception not thrown.');
     } catch (ezcMvcNamedRouteNotReversableException $e) {
         self::assertEquals("The route with name 'catchall' is of the 'ezcMvcCatchAllRoute' class, which does not support reversed route generation.", $e->getMessage());
     }
 }