當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。