本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Templating\EngineInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP EngineInterface::expects方法的具体用法?PHP EngineInterface::expects怎么用?PHP EngineInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Templating\EngineInterface
的用法示例。
在下文中一共展示了EngineInterface::expects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertRequestChangeStatus
protected function assertRequestChangeStatus()
{
$requestStatusEntity = new RequestStatus();
$requestStatusEntity->setLabel('StatusLabel');
$status = $this->getMock('Symfony\\Component\\Form\\FormInterface');
$status->expects($this->once())->method('getData')->will($this->returnValue($requestStatusEntity));
$note = $this->getMock('Symfony\\Component\\Form\\FormInterface');
$note->expects($this->once())->method('getData')->will($this->returnValue('note'));
$this->form->expects($this->exactly(2))->method('get')->with($this->logicalOr($this->equalTo('status'), $this->equalTo('note')))->will($this->returnCallback(function ($param) use($status, $note) {
$data = null;
switch ($param) {
case 'status':
$data = $status;
break;
case 'note':
$data = $note;
break;
default:
break;
}
return $data;
}));
$this->form->expects($this->once())->method('submit')->with($this->request);
$this->templating->expects($this->once())->method('render')->with('OroB2BRFPBundle:Request:note.html.twig', ['status' => $requestStatusEntity->getLabel(), 'note' => 'note'])->will($this->returnValue('message'));
}
示例2: testSerializerEnableMaxDepthChecks
/**
* @dataProvider serializerEnableMaxDepthChecksProvider
*/
public function testSerializerEnableMaxDepthChecks($enableMaxDepthChecks, $expectedMaxDepth)
{
$this->createViewResponseListener(['json' => true]);
$viewAnnotation = new ViewAnnotation([]);
$viewAnnotation->setSerializerEnableMaxDepthChecks($enableMaxDepthChecks);
$request = new Request();
$request->setRequestFormat('json');
$request->attributes->set('_view', $viewAnnotation);
$this->templating->expects($this->any())->method('render')->will($this->returnValue('foo'));
$view = new View();
$event = $this->getResponseEvent($request, $view);
$this->listener->onKernelView($event);
$context = $view->getSerializationContext();
$maxDepth = $context->getMaxDepth();
$this->assertEquals($expectedMaxDepth, $maxDepth);
}
示例3: testSerializerEnableMaxDepthChecks
/**
* @dataProvider serializerEnableMaxDepthChecksProvider
*/
public function testSerializerEnableMaxDepthChecks($enableMaxDepthChecks, $expectedMaxDepth)
{
$viewAnnotation = new ViewAnnotation([]);
$viewAnnotation->setSerializerEnableMaxDepthChecks($enableMaxDepthChecks);
$request = new Request();
$request->setRequestFormat('json');
$request->attributes->set('_view', $viewAnnotation);
$this->viewHandler = new ViewHandler(['json' => true]);
$this->viewHandler->setContainer($this->container);
// This is why we avoid container dependencies!
$that = $this;
$this->container->expects($this->exactly(2))->method('get')->with($this->logicalOr('fos_rest.view_handler', 'fos_rest.templating'))->will($this->returnCallback(function ($service) use($that) {
return $service === 'fos_rest.view_handler' ? $that->viewHandler : $that->templating;
}));
$this->templating->expects($this->any())->method('render')->will($this->returnValue('foo'));
$view = new View();
$event = $this->getResponseEvent($request, $view);
$this->listener->onKernelView($event);
$context = $view->getSerializationContext();
$maxDepth = $context->getMaxDepth();
$this->assertEquals($expectedMaxDepth, $maxDepth);
}