当前位置: 首页>>代码示例>>PHP>>正文


PHP EngineInterface::expects方法代码示例

本文整理汇总了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'));
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:25,代码来源:RequestChangeStatusHandlerTest.php

示例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);
 }
开发者ID:fsevestre,项目名称:FOSRestBundle,代码行数:19,代码来源:ViewResponseListenerTest.php

示例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);
 }
开发者ID:patxi1980,项目名称:FOSRestBundle,代码行数:25,代码来源:ViewResponseListenerTest.php


注:本文中的Symfony\Bundle\FrameworkBundle\Templating\EngineInterface::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。