Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
HttpKernelRuntime example
$renderer
->
render
(
'/foo'
)
;
}
public
function
testGenerateFragmentUri
(
)
{
$requestStack
=
new
RequestStack
(
)
;
$requestStack
->
push
(
Request::
create
(
'/'
)
)
;
$fragmentHandler
=
new
FragmentHandler
(
$requestStack
)
;
$fragmentUriGenerator
=
new
FragmentUriGenerator
(
'/_fragment',
new
UriSigner
(
's3cr3t'
)
,
$requestStack
)
;
$kernelRuntime
=
new
HttpKernelRuntime
(
$fragmentHandler
,
$fragmentUriGenerator
)
;
$loader
=
new
ArrayLoader
(
[
'index' =>
sprintf
(
<<<TWIG {{ fragment_uri(controller("%s::templateAction", {template: "foo.html.twig"})) }} TWIG
, TemplateController::
class
)
,
]
)
;
$twig
=
new
Environment
(
$loader
,
[
'debug' => true, 'cache' => false
]
)
;
$twig
->
addExtension
(
new
HttpKernelExtension
(
)
)
;
$loader
=
$this
->
createMock
(
RuntimeLoaderInterface::
class
)
;
$loader
->
expects
(
$this
->
any
(
)
)
->
method
(
'load'
)
->
willReturnMap
(
[
[