예제 #1
0
 /**
  * @param object|null $resource
  *
  * @return array
  */
 public function getRedirectParameters($resource = null)
 {
     $redirect = $this->parameters->get('redirect');
     if (!is_array($redirect) || empty($redirect['parameters'])) {
         $redirect = array('parameters' => array());
     }
     $parameters = $redirect['parameters'];
     if (null !== $resource) {
         $parameters = $this->parser->process($parameters, $resource);
     }
     return $parameters;
 }
예제 #2
0
 function it_returns_array_as_redirect_parameters(Parameters $parameters, ParametersParser $parser)
 {
     $parameters->get('redirect')->willReturn(null);
     $this->getRedirectParameters()->shouldReturn(array());
     $parameters->get('redirect')->willReturn('string');
     $this->getRedirectParameters()->shouldReturn(array());
     $parameters->get('redirect')->willReturn(array('parameters' => array('myParameter')));
     $this->getRedirectParameters()->shouldReturn(array('myParameter'));
     $params = array('myParameter');
     $parameters->get('redirect')->willReturn(array('parameters' => array('myParameter')));
     $parser->process($params, 'resource')->willReturn($params);
     $this->getRedirectParameters('resource')->shouldReturn($params);
 }