當前位置: 首頁>>代碼示例>>PHP>>正文


PHP RegistryInterface::expects方法代碼示例

本文整理匯總了PHP中Symfony\Bridge\Doctrine\RegistryInterface::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP RegistryInterface::expects方法的具體用法?PHP RegistryInterface::expects怎麽用?PHP RegistryInterface::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Bridge\Doctrine\RegistryInterface的用法示例。


在下文中一共展示了RegistryInterface::expects方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testProcess

 public function testProcess()
 {
     $this->form->expects($this->once())->method('setData')->with($this->entity);
     $this->request->expects($this->once())->method('getMethod')->will($this->returnValue('POST'));
     $this->form->expects($this->once())->method('submit');
     $this->form->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $this->manager->expects($this->once())->method('persist')->with($this->entity);
     $this->manager->expects($this->once())->method('flush');
     $this->assertTrue($this->handler->process($this->entity));
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:10,代碼來源:AbstractHandlerTest.php

示例2: prepareEvent

 protected function prepareEvent()
 {
     $this->entity->setEntities(['OroCRM\\Bundle\\AcmeBundle\\Entity\\TestEntity1', 'OroCRM\\Bundle\\AcmeBundle\\Entity\\TestEntity2']);
     $this->event->expects($this->atLeastOnce())->method('getChannel')->will($this->returnValue($this->entity));
     $this->settingProvider->expects($this->at(0))->method('getIntegrationConnectorName')->with('OroCRM\\Bundle\\AcmeBundle\\Entity\\TestEntity1')->will($this->returnValue('TestConnector1'));
     $this->settingProvider->expects($this->at(1))->method('getIntegrationConnectorName')->with('OroCRM\\Bundle\\AcmeBundle\\Entity\\TestEntity2')->will($this->returnValue('TestConnector2'));
     $this->registry->expects($this->any())->method('getManager')->will($this->returnValue($this->em));
     $this->em->expects($this->once())->method('persist')->with($this->integration);
     $this->em->expects($this->once())->method('flush');
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:10,代碼來源:ChannelSaveSucceedListenerTest.php

示例3: testProcessValidData

 public function testProcessValidData()
 {
     $this->request->setMethod('POST');
     $this->form->expects($this->once())->method('setData')->with($this->entity);
     $this->form->expects($this->once())->method('submit')->with($this->request);
     $this->form->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $this->registry->expects($this->any())->method('getManager')->will($this->returnValue($this->em));
     $this->em->expects($this->once())->method('persist')->with($this->entity);
     $this->em->expects($this->once())->method('flush');
     $this->dispatcher->expects($this->once())->method('dispatch')->with($this->equalTo(ChannelSaveEvent::EVENT_NAME), $this->isInstanceOf('OroCRM\\Bundle\\ChannelBundle\\Event\\ChannelSaveEvent'));
     $this->assertTrue($this->handler->process($this->entity));
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:12,代碼來源:ChannelHandlerTest.php

示例4: testOnChannelStatusChange

 /**
  * @dataProvider dataProvider
  */
 public function testOnChannelStatusChange($status, $isEnabled)
 {
     $integration = new Integration();
     $entity = new Channel();
     $entity->setStatus($status);
     $entity->setDataSource($integration);
     $this->registry->expects($this->any())->method('getManager')->will($this->returnValue($this->em));
     $this->em->expects($this->once())->method('persist')->with($integration);
     $this->em->expects($this->once())->method('flush');
     $listener = new ChangeChannelStatusListener($this->registry);
     $listener->onChannelStatusChange(new ChannelChangeStatusEvent($entity));
     $this->assertEquals($integration->getEnabled(), $isEnabled);
 }
開發者ID:dairdr,項目名稱:crm,代碼行數:16,代碼來源:ChangeChannelStatusListenerTest.php

示例5: testOnChannelSucceedSave

 public function testOnChannelSucceedSave()
 {
     $this->entity->setEntities(['OroCRM\\Bundle\\AcmeBundle\\Entity\\TestEntity1', 'OroCRM\\Bundle\\AcmeBundle\\Entity\\TestEntity2']);
     $this->event->expects($this->once())->method('getChannel')->will($this->returnValue($this->entity));
     $this->settingProvider->expects($this->at(0))->method('getIntegrationConnectorName')->with('OroCRM\\Bundle\\AcmeBundle\\Entity\\TestEntity1')->will($this->returnValue('TestConnector1'));
     $this->settingProvider->expects($this->at(1))->method('getIntegrationConnectorName')->with('OroCRM\\Bundle\\AcmeBundle\\Entity\\TestEntity2')->will($this->returnValue('TestConnector2'));
     $this->registry->expects($this->any())->method('getManager')->will($this->returnValue($this->em));
     $this->em->expects($this->once())->method('persist')->with($this->integration);
     $this->em->expects($this->once())->method('flush');
     $channelSaveSucceedListener = new ChannelSaveSucceedListener($this->settingProvider, $this->registry);
     $channelSaveSucceedListener->onChannelSucceedSave($this->event);
     $this->assertEquals($this->integration->getConnectors(), ['TestConnector1', 'TestConnector2']);
 }
開發者ID:dairdr,項目名稱:crm,代碼行數:13,代碼來源:ChannelSaveSucceedListenerTest.php


注:本文中的Symfony\Bridge\Doctrine\RegistryInterface::expects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。