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


PHP KernelInterface::expects方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpKernel\KernelInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP KernelInterface::expects方法的具体用法?PHP KernelInterface::expects怎么用?PHP KernelInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpKernel\KernelInterface的用法示例。


在下文中一共展示了KernelInterface::expects方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGuessTemplateNameWithCascadingParentBundle

 public function testGuessTemplateNameWithCascadingParentBundle()
 {
     $this->kernel->expects($this->at(1))->method('getBundle')->with($this->equalTo('BarBundle'), false)->will($this->returnValue(array($this->bundles['FooBarBundle'], $this->bundles['BarBundle'])));
     $this->kernel->expects($this->at(2))->method('getBundle')->with($this->equalTo('FooBundle'), false)->will($this->returnValue(array($this->bundles['FooBarBundle'], $this->bundles['BarBundle'], $this->bundles['FooBundle'])));
     $templateGuesser = new TemplateGuesser($this->kernel);
     $templateReference = $templateGuesser->guessTemplateName(array(new Fixture\FooBarBundle\Controller\FooBarController(), 'indexAction'), new Request());
     $this->assertEquals('FooBundle:FooBar:index.html.twig', (string) $templateReference);
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:8,代码来源:TemplateGuesserTest.php

示例2: setUp

 /**
  * setup
  */
 public function setUp()
 {
     $this->command = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Command\\GearmanWorkerListCommand')->setMethods(null)->getMock();
     $this->input = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->output = $this->getMockBuilder('Symfony\\Component\\Console\\Output\\OutputInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->gearmanClient = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Service\\GearmanClient')->disableOriginalConstructor()->setMethods(array('getWorkers'))->getMock();
     $this->gearmanClient->expects($this->any())->method('getWorkers')->will($this->returnValue(array(array('className' => '', 'callableName' => '', 'jobs' => array()))));
     $this->kernel->expects($this->any())->method('getEnvironment')->will($this->returnValue('dev'));
 }
开发者ID:MLKiiwy,项目名称:GearmanBundle,代码行数:13,代码来源:GearmanWorkerListCommandTest.php

示例3: setUp

 /**
  * Set up method
  */
 public function setUp()
 {
     $this->command = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Command\\GearmanCacheWarmupCommand')->setMethods(null)->getMock();
     $this->input = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->output = $this->getMockBuilder('Symfony\\Component\\Console\\Output\\OutputInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->gearmanCacheWrapper = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Service\\GearmanCacheWrapper')->disableOriginalConstructor()->setMethods(array('warmup'))->getMock();
     $this->gearmanCacheWrapper->expects($this->once())->method('warmup');
     $this->kernel->expects($this->any())->method('getEnvironment')->will($this->returnValue('dev'));
     $this->command->setGearmanCacheWrapper($this->gearmanCacheWrapper)->setKernel($this->kernel);
 }
开发者ID:MLKiiwy,项目名称:GearmanBundle,代码行数:14,代码来源:GearmanCacheWarmupCommandTest.php

示例4: testReadConfigurationFromManyBundles

 public function testReadConfigurationFromManyBundles()
 {
     $self = $this;
     $this->kernel->expects($this->once())->method('getBundles')->will($this->returnCallback(function () use($self) {
         $fooBundle = $self->getMock('Symfony\\Component\\HttpKernel\\Bundle\\Bundle', array('getPath'));
         $fooBundle->expects($self->any())->method('getPath')->will($self->returnValue(__DIR__ . '/../../../../Fixtures/FooBundle'));
         $barBundle = $self->getMock('Symfony\\Component\\HttpKernel\\Bundle\\Bundle', array('getPath'));
         $barBundle->expects($self->any())->method('getPath')->will($self->returnValue(__DIR__ . '/../../../../Fixtures/BarBundle'));
         return array($fooBundle, $barBundle);
     }));
     $dataSource = $this->getMockBuilder('FSi\\Component\\DataSource\\DataSource')->disableOriginalConstructor()->getMock();
     $dataSource->expects($this->any())->method('getName')->will($this->returnValue('news'));
     // 0 - 3 getName() is called
     $dataSource->expects($this->at(4))->method('addField')->with('title', 'text', 'like', array('label' => 'News Title'));
     $dataSource->expects($this->at(5))->method('addField')->with('author', null, null, array());
     $event = new ParametersEventArgs($dataSource, array());
     $this->subscriber->readConfiguration($event);
 }
开发者ID:norzechowicz,项目名称:datasource-bundle,代码行数:18,代码来源:ConfigurationBuilderTest.php

示例5: setUp

 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->testDir = sys_get_temp_dir();
     $bundleMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface')->disableOriginalConstructor()->getMock();
     $bundleMock->expects($this->any())->method('getPath')->will($this->returnValue($this->testDir));
     $this->kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->disableOriginalConstructor()->getMock();
     $this->kernelMock->expects($this->once())->method('getRootDir')->will($this->returnValue($this->testDir));
     $this->kernelMock->expects($this->once())->method('getBundles')->will($this->returnValue(array('bundle#1' => $bundleMock)));
 }
开发者ID:davamigo,项目名称:translator-bundle,代码行数:13,代码来源:ScannerTest.php

示例6: setUp

 /**
  * setup
  */
 public function setUp()
 {
     $this->command = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Command\\GearmanJobExecuteCommand')->setMethods(array('getHelperSet'))->getMock();
     $this->questionHelper = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\QuestionHelper')->setMethods(array('ask'))->getMock();
     $helperSet = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\HelperSet')->setMethods(array('get'))->getMock();
     $helperSet->expects($this->any())->method('get')->will($this->returnValue($this->questionHelper));
     $this->command->expects($this->any())->method('getHelperSet')->will($this->returnValue($helperSet));
     $this->input = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->output = $this->getMockBuilder('Symfony\\Component\\Console\\Output\\OutputInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->disableOriginalConstructor()->setMethods(array())->getMock();
     $this->gearmanClient = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Service\\GearmanClient')->disableOriginalConstructor()->setMethods(array('getJob'))->getMock();
     $this->gearmanDescriber = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Service\\GearmanDescriber')->disableOriginalConstructor()->setMethods(array('describeJob'))->getMock();
     $this->gearmanExecute = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Service\\GearmanExecute')->disableOriginalConstructor()->setMethods(array('executeJob'))->getMock();
     $this->kernel->expects($this->any())->method('getEnvironment')->will($this->returnValue('dev'));
 }
开发者ID:WayOfBrave,项目名称:GearmanBundle,代码行数:18,代码来源:GearmanJobExecuteCommandTest.php

示例7: setUp

 protected function setUp()
 {
     $this->emailCacheManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Cache\\EmailCacheManager')->disableOriginalConstructor()->getMock();
     $filesystemMap = $this->getMockBuilder('Knp\\Bundle\\GaufretteBundle\\FilesystemMap')->disableOriginalConstructor()->getMock();
     $this->filesystem = $this->getMockBuilder('Gaufrette\\Filesystem')->setMethods(['delete', 'write', 'has'])->disableOriginalConstructor()->getMock();
     $filesystemMap->expects($this->once())->method('get')->with('attachments')->will($this->returnValue($this->filesystem));
     $this->registry = $this->getMockBuilder('Doctrine\\Bundle\\DoctrineBundle\\Registry')->disableOriginalConstructor()->getMock();
     $this->configFileValidator = $this->getMockBuilder('Oro\\Bundle\\AttachmentBundle\\Validator\\ConfigFileValidator')->disableOriginalConstructor()->getMock();
     $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');
     $this->kernel->expects($this->once())->method('getRootDir')->willReturn('');
     $this->om = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ObjectManager')->disableOriginalConstructor()->getMock();
     $this->registry->expects($this->any())->method('getManager')->will($this->returnValue($this->om));
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->setMethods(['getLoggedUser'])->disableOriginalConstructor()->getMock();
     $this->securityFacadeLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->setMethods(['getService'])->disableOriginalConstructor()->getMock();
     $this->securityFacadeLink->expects($this->any())->method('getService')->will($this->returnValue($this->securityFacade));
     $this->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $this->attachment = $this->getMockBuilder('Oro\\Bundle\\AttachmentBundle\\Entity\\Attachment')->setMethods(['supportTarget'])->disableOriginalConstructor()->getMock();
     $this->attachmentConfig = $this->getMockBuilder('Oro\\Bundle\\AttachmentBundle\\EntityConfig\\AttachmentConfig')->disableOriginalConstructor()->getMock();
     $this->emailAttachmentManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Manager\\EmailAttachmentManager')->setMethods(['getAttachmentFullPath', 'buildAttachmentInstance'])->setConstructorArgs([$filesystemMap, $this->em, $this->kernel, $this->securityFacadeLink, $this->configFileValidator, $this->attachmentConfig])->getMock();
     $this->emailAttachmentManager->expects($this->any())->method('getAttachmentFullPath')->willReturn(__DIR__ . '/../Fixtures/attachment/test.txt');
 }
开发者ID:ramunasd,项目名称:platform,代码行数:21,代码来源:EmailAttachmentManagerTest.php

示例8: testDeleteActionWithModelManagerExceptionInDebugMode

 public function testDeleteActionWithModelManagerExceptionInDebugMode()
 {
     $this->setExpectedException('Sonata\\AdminBundle\\Exception\\ModelManagerException');
     $object = new \stdClass();
     $this->admin->expects($this->once())->method('getObject')->will($this->returnValue($object));
     $this->admin->expects($this->once())->method('isGranted')->with($this->equalTo('DELETE'))->will($this->returnValue(true));
     $this->admin->expects($this->once())->method('delete')->will($this->returnCallback(function () {
         throw new ModelManagerException();
     }));
     $this->kernel->expects($this->once())->method('isDebug')->will($this->returnValue(true));
     $this->request->setMethod('DELETE');
     $this->request->request->set('_sonata_csrf_token', 'csrf-token-123_sonata.delete');
     $this->controller->deleteAction(1, $this->request);
 }
开发者ID:gseric,项目名称:SonataAdminBundle,代码行数:14,代码来源:CRUDControllerTest.php

示例9: testDispatchEventWithoutEventDispatcher

 public function testDispatchEventWithoutEventDispatcher()
 {
     $this->kernel->expects($this->once())->method('getBundles')->willReturn([]);
     $this->eventDispatcher->expects($this->never())->method('dispatch');
     $this->assertEquals([], $this->getLoaderWithoutEventDispatcher()->load('file', 'type')->all());
 }
开发者ID:ramunasd,项目名称:platform,代码行数:6,代码来源:AbstractLoaderTest.php


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