本文整理汇总了PHP中Sonata\AdminBundle\Admin\Pool::setTemplates方法的典型用法代码示例。如果您正苦于以下问题:PHP Pool::setTemplates方法的具体用法?PHP Pool::setTemplates怎么用?PHP Pool::setTemplates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Admin\Pool
的用法示例。
在下文中一共展示了Pool::setTemplates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testdashboardActionAjaxLayout
public function testdashboardActionAjaxLayout()
{
$container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
$pool = new Pool($container, 'title', 'logo.png');
$pool->setTemplates(array('ajax' => 'ajax.html'));
$templating = $this->getMock('Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface');
$request = new Request();
$request->headers->set('X-Requested-With', 'XMLHttpRequest');
$requestStack = null;
if (Kernel::MINOR_VERSION > 3) {
$requestStack = new \Symfony\Component\HttpFoundation\RequestStack();
$requestStack->push($request);
}
$values = array('sonata.admin.pool' => $pool, 'templating' => $templating, 'request' => $request, 'request_stack' => $requestStack);
$container->expects($this->any())->method('get')->will($this->returnCallback(function ($id) use($values) {
return $values[$id];
}));
$container->expects($this->any())->method('getParameter')->will($this->returnCallback(function ($name) {
if ($name == 'sonata.admin.configuration.dashboard_blocks') {
return array();
}
}));
$controller = new CoreController();
$controller->setContainer($container);
$response = $controller->dashboardAction();
$this->isInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response);
}
示例2: testTemplates
public function testTemplates()
{
$this->assertInternalType('array', $this->pool->getTemplates());
$this->pool->setTemplates(array('ajax' => 'Foo.html.twig'));
$this->assertNull($this->pool->getTemplate('bar'));
$this->assertEquals('Foo.html.twig', $this->pool->getTemplate('ajax'));
}