/**
  * @see sfRequestRoute
  */
 public function matchesParameters($params, $context = array())
 {
     if (!isset($this->options['host_route'])) {
         return parent::matchesParameters($params, $context);
     }
     $hostParams = $this->extractHostParams($params);
     return parent::matchesParameters($params, $context) && $this->options['host_route']->matchesParameters($hostParams, $context);
 }
Ejemplo n.º 2
0
 /**
  * Returns true if the parameters matches this route, false otherwise.
  *
  * @param  mixed  $params  The parameters
  * @param  array  $context The context
  *
  * @return Boolean         true if the parameters matches this route, false otherwise.
  */
 public function matchesParameters($params, $context = array())
 {
     return parent::matchesParameters('object' == $this->options['type'] ? $this->convertObjectToArray($params) : $params);
 }
Ejemplo n.º 3
0
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(8);
// ->__construct()
$t->diag('->__construct()');
$route = new sfRequestRoute('/');
$requirements = $route->getRequirements();
$t->is_deeply($requirements['sf_method'], array('get', 'head'), '->__construct() applies a default "sf_method" requirement of GET or HEAD');
$route = new sfRequestRoute('/', array(), array('sf_method' => array('post')));
$requirements = $route->getRequirements();
$t->is_deeply($requirements['sf_method'], array('post'), '->__construct() does not apply a default "sf_method" requirement if one is already set');
$route = new sfRequestRoute('/', array(), array('sf_method' => 'get'));
$requirements = $route->getRequirements();
$t->is_deeply($requirements['sf_method'], array('get'), '->__construct() converts a string "sf_method" requirement to an array');
// ->matchesParameters()
$t->diag('->matchesParameters()');
$route = new sfRequestRoute('/', array(), array('sf_method' => array('get', 'head')));
$t->ok($route->matchesParameters(array('sf_method' => 'get')), '->matchesParameters() matches the "sf_method" parameter');
$route = new sfRequestRoute('/', array(), array('sf_method' => array('get')));
$t->ok($route->matchesParameters(array('sf_method' => 'GET')), '->matchesParameters() checks "sf_method" requirement case-insensitively');
$route = new sfRequestRoute('/', array(), array('sf_method' => array('GET')));
$t->ok($route->matchesParameters(array('sf_method' => 'get')), '->matchesParameters() checks "sf_method" requirement case-insensitively');
// ->matchesUrl()
$t->diag('->matchesUrl()');
$route = new sfRequestRoute('/', array(), array('sf_method' => 'GET'));
$t->isa_ok($route->matchesUrl('/', array('method' => 'get')), 'array', '->matchesUrl() check "sf_method" requirement case-insensitively');
$route = new sfRequestRoute('/', array(), array('sf_method' => 'get'));
$t->isa_ok($route->matchesUrl('/', array('method' => 'GET')), 'array', '->matchesUrl() check "sf_method" requirement case-insensitively');
Ejemplo n.º 4
0
 public function matchesParameters($params, $context = array())
 {
     $params = array_merge(array('username' => $this->getUserId()), $params);
     return parent::matchesParameters($params, $context);
 }