class LazyLoadingFragmentHandlerTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php \Symfony\Component\HttpKernel\Tests\DependencyInjection\LazyLoadingFragmentHandlerTest
Hierarchy
- class \Symfony\Component\HttpKernel\Tests\DependencyInjection\LazyLoadingFragmentHandlerTest extends \Symfony\Component\HttpKernel\Tests\DependencyInjection\PHPUnit_Framework_TestCase
Expanded class hierarchy of LazyLoadingFragmentHandlerTest
File
- vendor/
symfony/ http-kernel/ Tests/ DependencyInjection/ LazyLoadingFragmentHandlerTest.php, line 18
Namespace
Symfony\Component\HttpKernel\Tests\DependencyInjectionView source
class LazyLoadingFragmentHandlerTest extends \PHPUnit_Framework_TestCase {
public function test() {
$renderer = $this
->getMock('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface');
$renderer
->expects($this
->once())
->method('getName')
->will($this
->returnValue('foo'));
$renderer
->expects($this
->any())
->method('render')
->will($this
->returnValue(new Response()));
$requestStack = $this
->getMock('Symfony\\Component\\HttpFoundation\\RequestStack');
$requestStack
->expects($this
->any())
->method('getCurrentRequest')
->will($this
->returnValue(Request::create('/')));
$container = $this
->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
$container
->expects($this
->once())
->method('get')
->will($this
->returnValue($renderer));
$handler = new LazyLoadingFragmentHandler($container, false, $requestStack);
$handler
->addRendererService('foo', 'foo');
$handler
->render('/foo', 'foo');
// second call should not lazy-load anymore (see once() above on the get() method)
$handler
->render('/foo', 'foo');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LazyLoadingFragmentHandlerTest:: |
public | function |