protected function getFragmentHandler($return) { $strategy = $this->getMock('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface'); $strategy->expects($this->once())->method('getName')->will($this->returnValue('inline')); $strategy->expects($this->once())->method('render')->will($return); $renderer = new FragmentHandler(array($strategy)); $renderer->setRequest(Request::create('/')); return $renderer; }
protected function getHandler($returnValue, $arguments = array()) { $renderer = $this->getMock('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface'); $renderer->expects($this->any())->method('getName')->will($this->returnValue('foo')); $e = $renderer->expects($this->any())->method('render')->will($returnValue); if ($arguments) { call_user_func_array(array($e, 'with'), $arguments); } $handler = new FragmentHandler(); $handler->addRenderer($renderer); $handler->setRequest(Request::create('/')); return $handler; }