Commit 7f57b354 authored by Taddeus Kroes's avatar Taddeus Kroes

Added full unit test suite for URL plugin.

parent a6e7de46
......@@ -34,20 +34,6 @@ class pQueryUrl extends pQuery {
return preg_replace('%(^/|/$)%', '', $url);
}
/**
* Execute the handler of the first matching URL regex.
*
* @param string $path The path to add.
* @param bool $relative Indicates whether the path is relative to the document root.
*/
function handler() {
foreach( self::$handlers as $pattern => $handler )
if( preg_match($pattern, $this->url, $matches) )
return call_user_func_array($handler, array_slice($matches, 1));
//self::error('URL has no handler.', $this->url);
}
/**
* Add a handler function to a URL match.
*
......@@ -68,6 +54,22 @@ class pQueryUrl extends pQuery {
foreach( $handlers as $pattern => $handler )
self::add_handler($pattern, $handler);
}
/**
* Execute the handler of the first matching URL regex.
*
* @param string $path The path to add.
* @param bool $relative Indicates whether the path is relative to the document root.
*/
function handler() {
foreach( self::$handlers as $pattern => $handler )
if( preg_match($pattern, $this->url, $matches) )
return call_user_func_array($handler, array_slice($matches, 1));
self::error('URL "%s" has no handler.', $this->url);
// @codeCoverageIgnoreStart
}
// @codeCoverageIgnoreEnd
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment