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


PHP ObjectManagerInterface::expects方法代码示例

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


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

示例1: setControllerObjectNameAndSetControllerCommandNameUnsetTheBuiltCommandObject

 /**
  * @test
  */
 public function setControllerObjectNameAndSetControllerCommandNameUnsetTheBuiltCommandObject()
 {
     $this->request->setControllerObjectName('Tx_Extbase_Command_CacheCommandController');
     $this->request->setControllerCommandName('flush');
     $this->request->getCommand();
     $this->request->setControllerObjectName('Tx_SomeExtension_Command_BeerCommandController');
     $this->request->setControllerCommandName('drink');
     $this->mockObjectManager->expects($this->once())->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, 'Tx_SomeExtension_Command_BeerCommandController', 'drink');
     $this->request->getCommand();
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:13,代码来源:RequestTest.php

示例2: is_datetime_created_with_invalid_text

 /**
  * @test
  */
 public function is_datetime_created_with_invalid_text()
 {
     $import = $this->getMock(Import::class);
     $strategy = $this->getMock(Strategy::class);
     $path = './import.csv';
     $import->expects($this->once())->method('setStarttime')->with($this->isInstanceOf(\DateTime::class));
     $this->objectManager->expects($this->once())->method('get')->with(Import::class)->will($this->returnCallback(function () use($import) {
         return $import;
     }));
     $this->fixture->addToQueue($path, $strategy, ['start' => 'Lorem ipsum']);
 }
开发者ID:sirdiego,项目名称:importr,代码行数:14,代码来源:ImportServiceTest.php

示例3: injectDependencies

 /**
  * @return void
  */
 protected function injectDependencies()
 {
     $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
     $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
     $this->mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Web\Request::class)->will($this->returnValue($this->mockRequest));
     $this->requestBuilder->_set('objectManager', $this->mockObjectManager);
     $pluginNamespace = 'tx_' . strtolower($this->configuration['extensionName'] . '_' . $this->configuration['pluginName']);
     $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue($pluginNamespace));
     $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
     $this->mockEnvironmentService->expects($this->any())->method('getServerRequestMethod')->will($this->returnValue('GET'));
     $this->requestBuilder->_set('environmentService', $this->mockEnvironmentService);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:15,代码来源:RequestBuilderTest.php

示例4: setUp

 protected function setUp()
 {
     $this->widgetRequestBuilder = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequestBuilder::class, array('setArgumentsFromRawRequestData'));
     $this->mockWidgetRequest = $this->getMock(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class);
     $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
     $this->mockObjectManager->expects($this->once())->method('get')->with(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class)->will($this->returnValue($this->mockWidgetRequest));
     $this->widgetRequestBuilder->_set('objectManager', $this->mockObjectManager);
     $this->mockWidgetContext = $this->getMock(\TYPO3\CMS\Fluid\Core\Widget\WidgetContext::class);
     $this->mockAjaxWidgetContextHolder = $this->getMock(\TYPO3\CMS\Fluid\Core\Widget\AjaxWidgetContextHolder::class, array(), array(), '', false);
     $this->widgetRequestBuilder->injectAjaxWidgetContextHolder($this->mockAjaxWidgetContextHolder);
     $this->mockAjaxWidgetContextHolder->expects($this->once())->method('get')->will($this->returnValue($this->mockWidgetContext));
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:12,代码来源:WidgetRequestBuilderTest.php

示例5: setUp

 public function setUp()
 {
     $this->widgetRequestBuilder = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\Widget\\WidgetRequestBuilder', array('setArgumentsFromRawRequestData'));
     $this->mockWidgetRequest = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Widget\\WidgetRequest');
     $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
     $this->mockObjectManager->expects($this->once())->method('get')->with('TYPO3\\CMS\\Fluid\\Core\\Widget\\WidgetRequest')->will($this->returnValue($this->mockWidgetRequest));
     $this->widgetRequestBuilder->_set('objectManager', $this->mockObjectManager);
     $this->mockWidgetContext = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Widget\\WidgetContext');
     $this->mockAjaxWidgetContextHolder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Widget\\AjaxWidgetContextHolder', array(), array(), '', FALSE);
     $this->widgetRequestBuilder->injectAjaxWidgetContextHolder($this->mockAjaxWidgetContextHolder);
     $this->mockAjaxWidgetContextHolder->expects($this->once())->method('get')->will($this->returnValue($this->mockWidgetContext));
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:12,代码来源:WidgetRequestBuilderTest.php

示例6: getAvailableCommandsReturnsAllAvailableCommands

 /**
  * @test
  * @author Bastian Waidelich <bastian@typo3.org>
  */
 public function getAvailableCommandsReturnsAllAvailableCommands()
 {
     /** @var \TYPO3\CMS\Core\Tests\AccessibleObjectInterface $commandManager */
     $commandManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class, array('dummy'));
     $commandManager->_set('objectManager', $this->mockObjectManager);
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'] = array(\TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockACommandController::class, \TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockBCommandController::class);
     $mockCommand1 = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', FALSE);
     $mockCommand2 = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', FALSE);
     $mockCommand3 = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', FALSE);
     $this->mockObjectManager->expects($this->at(0))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockACommandController::class, 'foo')->will($this->returnValue($mockCommand1));
     $this->mockObjectManager->expects($this->at(1))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockACommandController::class, 'bar')->will($this->returnValue($mockCommand2));
     $this->mockObjectManager->expects($this->at(2))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockBCommandController::class, 'baz')->will($this->returnValue($mockCommand3));
     $commands = $commandManager->getAvailableCommands();
     $this->assertEquals(3, count($commands));
     $this->assertSame($mockCommand1, $commands[0]);
     $this->assertSame($mockCommand2, $commands[1]);
     $this->assertSame($mockCommand3, $commands[2]);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:22,代码来源:CommandManagerTest.php

示例7: setUp

 /**
  * Sets up this test case
  *
  * @author Robert Lemke <robert@typo3.org>
  */
 protected function setUp()
 {
     $this->request = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class, array('dummy'));
     $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
     $this->mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class)->will($this->returnValue($this->request));
     $this->mockCommand = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', FALSE);
     $this->mockCommand->expects($this->any())->method('getControllerClassName')->will($this->returnValue('Tx_SomeExtensionName_Command_DefaultCommandController'));
     $this->mockCommand->expects($this->any())->method('getControllerCommandName')->will($this->returnValue('list'));
     $this->mockCommandManager = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class);
     $this->mockCommandManager->expects($this->any())->method('getCommandByIdentifier')->with('some_extension_name:default:list')->will($this->returnValue($this->mockCommand));
     $this->mockReflectionService = $this->getMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
     $this->mockConfigurationManager = $this->getMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
     $this->requestBuilder = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::class, array('dummy'));
     $this->requestBuilder->_set('objectManager', $this->mockObjectManager);
     $this->requestBuilder->_set('reflectionService', $this->mockReflectionService);
     $this->requestBuilder->_set('commandManager', $this->mockCommandManager);
     $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:23,代码来源:RequestBuilderTest.php

示例8: convertFromShouldThrowExceptionIfPropertyOnTargetObjectCouldNotBeSet

 /**
  * @test
  * @expectedException \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException
  */
 public function convertFromShouldThrowExceptionIfPropertyOnTargetObjectCouldNotBeSet()
 {
     $source = array('propertyX' => 'bar');
     $object = new \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSetters();
     $convertedChildProperties = array('propertyNotExisting' => 'bar');
     $this->mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSetters::class)->will($this->returnValue($object));
     $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSetters::class, '__construct')->will($this->returnValue(array()));
     $configuration = $this->buildConfiguration(array(PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true));
     $result = $this->converter->convertFrom($source, \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSetters::class, $convertedChildProperties, $configuration);
     $this->assertSame($object, $result);
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:15,代码来源:PersistentObjectConverterTest.php

示例9: mergeWithExistingConfigurationOverwritesDefaultKeysWithCurrent

 /**
  * @test
  * @return void
  */
 public function mergeWithExistingConfigurationOverwritesDefaultKeysWithCurrent()
 {
     $localConfiguration = serialize(array('FE.' => array('enabled' => '1', 'saltedPWHashingMethod' => \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface_sha1::class), 'CLI.' => array('enabled' => '0')));
     $configurationManagerMock = $this->getMock(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
     $configurationManagerMock->expects($this->once())->method('getConfigurationValueByPath')->with('EXT/extConf/testextensionkey')->will($this->returnValue($localConfiguration));
     $this->injectedObjectManagerMock->expects($this->any())->method('get')->will($this->returnValue($configurationManagerMock));
     $defaultConfiguration = array('FE.enabled' => array('value' => '0'), 'FE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class), 'BE.enabled' => array('value' => '1'), 'BE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class));
     $expectedResult = array('FE.enabled' => array('value' => '1'), 'FE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface_sha1::class), 'BE.enabled' => array('value' => '1'), 'BE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class), 'CLI.enabled' => array('value' => '0'));
     $actualResult = $this->configurationItemRepository->_call('mergeWithExistingConfiguration', $defaultConfiguration, 'testextensionkey');
     $this->assertEquals($expectedResult, $actualResult);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:15,代码来源:ConfigurationItemRepositoryTest.php

示例10: convertFromShouldThrowExceptionIfRequiredConstructorParameterWasNotFound

 /**
  * @test
  * @expectedException \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException
  */
 public function convertFromShouldThrowExceptionIfRequiredConstructorParameterWasNotFound()
 {
     $source = array('propertyX' => 'bar');
     $object = new \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor('param1');
     $convertedChildProperties = array('property2' => 'bar');
     $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, '__construct')->will($this->returnValue(array('property1' => array('optional' => false))));
     $this->mockReflectionService->expects($this->any())->method('hasMethod')->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, '__construct')->will($this->returnValue(true));
     $this->mockObjectManager->expects($this->any())->method('getClassNameByObjectName')->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class)->will($this->returnValue(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class));
     $this->mockContainer->expects($this->any())->method('getImplementationClassName')->will($this->returnValue(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class));
     $configuration = $this->buildConfiguration(array(PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true));
     $result = $this->converter->convertFrom($source, \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, $convertedChildProperties, $configuration);
     $this->assertSame($object, $result);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:17,代码来源:PersistentObjectConverterTest.php

示例11: getSecurityStatusOfExtensionsReturnsErrorForExistingExtensionIfOutdatedExtensionExists

 /**
  * @test
  */
 public function getSecurityStatusOfExtensionsReturnsErrorForExistingExtensionIfOutdatedExtensionExists()
 {
     /** @var $mockTerObject \TYPO3\CMS\Extensionmanager\Domain\Model\Extension|\PHPUnit_Framework_MockObject_MockObject */
     $mockTerObject = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Extension');
     $mockTerObject->expects($this->any())->method('getVersion')->will($this->returnValue('1.0.6'));
     $mockTerObject->expects($this->atLeastOnce())->method('getReviewState')->will($this->returnValue(-2));
     $mockExtensionList = array('enetcache' => array('terObject' => $mockTerObject));
     /** @var $mockListUtility \TYPO3\CMS\Extensionmanager\Utility\ListUtility|\PHPUnit_Framework_MockObject_MockObject */
     $mockListUtility = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility');
     $mockListUtility->expects($this->once())->method('getAvailableAndInstalledExtensionsWithAdditionalInformation')->will($this->returnValue($mockExtensionList));
     /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
     $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
     $mockReport->_set('objectManager', $this->mockObjectManager);
     $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
     $this->mockObjectManager->expects($this->at(3))->method('get')->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::WARNING)->will($this->returnValue($statusMock));
     $mockReport->_set('listUtility', $mockListUtility);
     $mockReport->_set('languageService', $this->mockLanguageService);
     $result = $mockReport->_call('getSecurityStatusOfExtensions');
     /** @var $loadedResult \TYPO3\CMS\Reports\Status */
     $loadedResult = $result->existingoutdated;
     $this->assertSame($statusMock, $loadedResult);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:25,代码来源:ExtensionStatusTest.php

示例12: initiateSubRequestBuildsRequestProperly

 /**
  * @test
  */
 public function initiateSubRequestBuildsRequestProperly()
 {
     $controller = $this->getMock(\TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController::class, array(), array(), '', FALSE);
     $this->viewHelper->_set('controller', $controller);
     // Initial Setup
     $widgetRequest = $this->getMock(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class);
     $response = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Web\Response::class);
     $this->objectManager->expects($this->at(0))->method('get')->with(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class)->will($this->returnValue($widgetRequest));
     $this->objectManager->expects($this->at(1))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Web\Response::class)->will($this->returnValue($response));
     // Widget Context is set
     $widgetRequest->expects($this->once())->method('setWidgetContext')->with($this->widgetContext);
     // The namespaced arguments are passed to the sub-request
     // and the action name is exctracted from the namespace.
     $this->controllerContext->expects($this->once())->method('getRequest')->will($this->returnValue($this->request));
     $this->widgetContext->expects($this->once())->method('getWidgetIdentifier')->will($this->returnValue('widget-1'));
     $this->request->expects($this->once())->method('getArguments')->will($this->returnValue(array('k1' => 'k2', 'widget-1' => array('arg1' => 'val1', 'arg2' => 'val2', 'action' => 'myAction'))));
     $widgetRequest->expects($this->once())->method('setArguments')->with(array('arg1' => 'val1', 'arg2' => 'val2'));
     $widgetRequest->expects($this->once())->method('setControllerActionName')->with('myAction');
     // Controller is called
     $controller->expects($this->once())->method('processRequest')->with($widgetRequest, $response);
     $output = $this->viewHelper->_call('initiateSubRequest');
     // SubResponse is returned
     $this->assertSame($response, $output);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:27,代码来源:AbstractWidgetViewHelperTest.php

示例13: testResolverUsesObjectManagerToRetrieveConcreteImplementation

 /**
  * ResolverUsesObjectManagerToRetrieveConcreteImplementation
  *
  * @return void
  */
 public function testResolverUsesObjectManagerToRetrieveConcreteImplementation()
 {
     $this->objectManagerMock->expects($this->once())->method('get')->with($this->equalTo('DreadLabs\\VantomasWebsite\\Disqus\\Resource\\Foo\\Bar'));
     $this->patternProviderMock->expects($this->once())->method('getPattern')->willReturn('DreadLabs\\VantomasWebsite\\Disqus\\Resource\\%s\\%s');
     $this->sut->resolve('Foo', 'Bar');
 }
开发者ID:svenhartmann,项目名称:vantomas,代码行数:11,代码来源:ResourceResolverObjectManagerAdapterTest.php


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