本文整理汇总了PHP中TYPO3\Flow\Object\ObjectManagerInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManagerInterface::expects方法的具体用法?PHP ObjectManagerInterface::expects怎么用?PHP ObjectManagerInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Object\ObjectManagerInterface
的用法示例。
在下文中一共展示了ObjectManagerInterface::expects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Sets up this test case
*
*/
protected function setUp()
{
$this->mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$this->mockObjectManager->expects($this->any())->method('isRegistered')->will($this->returnCallback(array($this, 'objectManagerIsRegisteredCallback')));
$this->parser = $this->getAccessibleMock(Parser::class, array('dummy'));
$this->parser->_set('objectManager', $this->mockObjectManager);
}
示例2: setUp
/**
* Sets up this test case
*
*/
protected function setUp()
{
$this->mockObjectManager = $this->createMock('TYPO3\\Flow\\Object\\ObjectManagerInterface');
$this->mockObjectManager->expects($this->any())->method('isRegistered')->will($this->returnCallback(array($this, 'objectManagerIsRegisteredCallback')));
$this->parser = $this->getAccessibleMock('TYPO3\\TypoScript\\Core\\Parser', array('dummy'));
$this->parser->_set('objectManager', $this->mockObjectManager);
}
示例3: setUp
/**
* Sets up this test case
*
* @author Robert Lemke <robert@typo3.org>
*/
protected function setUp()
{
$this->mockObjectManager = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface', array(), array(), '', false);
$this->mockObjectManager->expects($this->any())->method('isRegistered')->will($this->returnCallback(array($this, 'objectManagerIsRegisteredCallback')));
$parserClassName = $this->buildAccessibleProxy('TYPO3\\TypoScript\\Core\\Parser');
$this->parser = new $parserClassName();
$this->parser->_set('objectManager', $this->mockObjectManager);
}
示例4: setUp
/**
* Prepare test objects
*/
protected function setUp()
{
$this->nodeFactory = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Factory\\NodeFactory', array('filterNodeByContext'));
$this->nodeFactory->expects(self::any())->method('filterNodeByContext')->willReturnArgument(0);
$this->reflectionServiceMock = $this->getMock('TYPO3\\Flow\\Reflection\\ReflectionService');
$this->reflectionServiceMock->expects(self::any())->method('getAllImplementationClassNamesForInterface')->with('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->willReturn(array('TYPO3\\TYPO3CR\\Domain\\Model\\Node'));
$this->objectManagerMock = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface');
$this->objectManagerMock->expects(self::any())->method('get')->with('TYPO3\\Flow\\Reflection\\ReflectionService')->willReturn($this->reflectionServiceMock);
$this->objectManagerMock->expects(self::any())->method('getClassNameByObjectName')->with('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->willReturn('TYPO3\\TYPO3CR\\Domain\\Model\\Node');
$this->inject($this->nodeFactory, 'objectManager', $this->objectManagerMock);
}
示例5: setUp
/**
* Prepare test objects
*/
protected function setUp()
{
$this->nodeFactory = $this->getMockBuilder(NodeFactory::class)->setMethods(array('filterNodeByContext'))->getMock();
$this->nodeFactory->expects(self::any())->method('filterNodeByContext')->willReturnArgument(0);
$this->reflectionServiceMock = $this->createMock(ReflectionService::class);
$this->reflectionServiceMock->expects(self::any())->method('getAllImplementationClassNamesForInterface')->with(NodeInterface::class)->willReturn(array(Node::class));
$this->objectManagerMock = $this->createMock(ObjectManagerInterface::class);
$this->objectManagerMock->expects(self::any())->method('get')->with(ReflectionService::class)->willReturn($this->reflectionServiceMock);
$this->objectManagerMock->expects(self::any())->method('getClassNameByObjectName')->with(NodeInterface::class)->willReturn(Node::class);
$this->inject($this->nodeFactory, 'objectManager', $this->objectManagerMock);
}
示例6: setUp
/**
* Sets up this test case
*
*/
public function setUp()
{
$this->mockObjectManager = $this->createMock(\TYPO3\Flow\Object\ObjectManagerInterface::class);
$this->mockObjectManager->expects($this->any())->method('getObjectNameByClassName')->with('Acme\\Test\\Command\\DefaultCommandController')->will($this->returnValue('Acme\\Test\\Command\\DefaultCommandController'));
$this->mockCommand = $this->getMockBuilder(\TYPO3\Flow\Cli\Command::class)->disableOriginalConstructor()->getMock();
$this->mockCommand->expects($this->any())->method('getControllerClassName')->will($this->returnValue('Acme\\Test\\Command\\DefaultCommandController'));
$this->mockCommand->expects($this->any())->method('getControllerCommandName')->will($this->returnValue('list'));
$this->mockCommandManager = $this->createMock(\TYPO3\Flow\Cli\CommandManager::class);
$this->mockCommandManager->expects($this->any())->method('getCommandByIdentifier')->with('acme.test:default:list')->will($this->returnValue($this->mockCommand));
$this->mockReflectionService = $this->createMock(\TYPO3\Flow\Reflection\ReflectionService::class);
$this->requestBuilder = new \TYPO3\Flow\Cli\RequestBuilder();
$this->requestBuilder->injectObjectManager($this->mockObjectManager);
$this->requestBuilder->injectCommandManager($this->mockCommandManager);
}
示例7: setUp
/**
* Sets up this test case
*
*/
public function setUp()
{
$this->mockObjectManager = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface');
$this->mockObjectManager->expects($this->any())->method('getObjectNameByClassName')->with('Acme\\Test\\Command\\DefaultCommandController')->will($this->returnValue('Acme\\Test\\Command\\DefaultCommandController'));
$this->mockCommand = $this->getMock('TYPO3\\Flow\\Cli\\Command', array(), array(), '', FALSE);
$this->mockCommand->expects($this->any())->method('getControllerClassName')->will($this->returnValue('Acme\\Test\\Command\\DefaultCommandController'));
$this->mockCommand->expects($this->any())->method('getControllerCommandName')->will($this->returnValue('list'));
$this->mockCommandManager = $this->getMock('TYPO3\\Flow\\Cli\\CommandManager');
$this->mockCommandManager->expects($this->any())->method('getCommandByIdentifier')->with('acme.test:default:list')->will($this->returnValue($this->mockCommand));
$this->mockReflectionService = $this->getMock('TYPO3\\Flow\\Reflection\\ReflectionService');
$this->requestBuilder = new \TYPO3\Flow\Cli\RequestBuilder();
$this->requestBuilder->injectObjectManager($this->mockObjectManager);
$this->requestBuilder->injectReflectionService($this->mockReflectionService);
$this->requestBuilder->injectCommandManager($this->mockCommandManager);
}
示例8: setUp
/**
* @return void
*/
public function setUp()
{
parent::setup();
vfsStream::setup('Foo');
$this->httpRequest = Request::create(new Uri('http://localhost'));
$this->httpResponse = new Response();
$mockRequestHandler = $this->createMock(\TYPO3\Flow\Http\RequestHandler::class, array(), array(), '', false, false);
$mockRequestHandler->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->httpRequest));
$mockRequestHandler->expects($this->any())->method('getHttpResponse')->will($this->returnValue($this->httpResponse));
$this->mockBootstrap = $this->createMock(\TYPO3\Flow\Core\Bootstrap::class, array(), array(), '', false, false);
$this->mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($mockRequestHandler));
$this->mockSecurityContext = $this->createMock(\TYPO3\Flow\Security\Context::class, array(), array(), '', false, false);
$this->mockObjectManager = $this->createMock(\TYPO3\Flow\Object\ObjectManagerInterface::class, array(), array(), '', false, false);
$this->mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\Flow\Security\Context::class)->will($this->returnValue($this->mockSecurityContext));
}
示例9: setUp
/**
* @return void
*/
public function setUp()
{
parent::setup();
vfsStream::setup('Foo');
$this->httpRequest = Request::create(new Uri('http://localhost'));
$this->httpResponse = new Response();
$mockRequestHandler = $this->getMock('TYPO3\\Flow\\Http\\RequestHandler', array(), array(), '', FALSE, FALSE);
$mockRequestHandler->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->httpRequest));
$mockRequestHandler->expects($this->any())->method('getHttpResponse')->will($this->returnValue($this->httpResponse));
$this->mockBootstrap = $this->getMock('TYPO3\\Flow\\Core\\Bootstrap', array(), array(), '', FALSE, FALSE);
$this->mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($mockRequestHandler));
$this->mockSecurityContext = $this->getMock('TYPO3\\Flow\\Security\\Context', array(), array(), '', FALSE, FALSE);
$this->mockObjectManager = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface', array(), array(), '', FALSE, FALSE);
$this->mockObjectManager->expects($this->any())->method('get')->with('TYPO3\\Flow\\Security\\Context')->will($this->returnValue($this->mockSecurityContext));
}
示例10: resolveViewThrowsExceptionIfViewCouldNotBeResolved
/**
* @test
* @expectedException \TYPO3\Flow\Mvc\Exception\ViewNotFoundException
*/
public function resolveViewThrowsExceptionIfViewCouldNotBeResolved()
{
$this->mockObjectManager->expects($this->any())->method('getCaseSensitiveObjectName')->will($this->returnValue(false));
$this->actionController->_set('defaultViewObjectName', 'ViewDefaultObjectName');
$this->mockObjectManager->expects($this->once())->method('get')->with('ViewDefaultObjectName')->will($this->returnValue(null));
$this->actionController->_call('resolveView');
}
示例11: setUp
/**
* Sets up this test case
*/
public function setUp()
{
$this->dispatcher = $this->getMock(\TYPO3\Flow\Mvc\Dispatcher::class, array('resolveController'), array(), '', FALSE);
$this->mockActionRequest = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock();
$this->mockActionRequest->expects($this->any())->method('isMainRequest')->will($this->returnValue(FALSE));
$this->mockParentRequest = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock();
$this->mockActionRequest->expects($this->any())->method('getParentRequest')->will($this->returnValue($this->mockParentRequest));
$this->mockMainRequest = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock();
$this->mockActionRequest->expects($this->any())->method('getMainRequest')->will($this->returnValue($this->mockMainRequest));
$this->mockHttpRequest = $this->getMockBuilder(\TYPO3\Flow\Http\Request::class)->disableOriginalConstructor()->getMock();
$this->mockActionRequest->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->mockHttpRequest));
$this->mockHttpResponse = $this->getMockBuilder(\TYPO3\Flow\Http\Response::class)->disableOriginalConstructor()->getMock();
$this->mockController = $this->getMock(\TYPO3\Flow\Mvc\Controller\ControllerInterface::class, array('processRequest'));
$this->dispatcher->expects($this->any())->method('resolveController')->will($this->returnValue($this->mockController));
$this->mockSecurityContext = $this->getMockBuilder(\TYPO3\Flow\Security\Context::class)->disableOriginalConstructor()->getMock();
$this->mockFirewall = $this->getMockBuilder(\TYPO3\Flow\Security\Authorization\FirewallInterface::class)->getMock();
$this->mockSecurityLogger = $this->getMockBuilder(\TYPO3\Flow\Log\SecurityLoggerInterface::class)->getMock();
$this->mockObjectManager = $this->getMockBuilder(\TYPO3\Flow\Object\ObjectManagerInterface::class)->getMock();
$this->mockObjectManager->expects($this->any())->method('get')->will($this->returnCallback(function ($className) {
if ($className === \TYPO3\Flow\Security\Context::class) {
return $this->mockSecurityContext;
} elseif ($className === \TYPO3\Flow\Security\Authorization\FirewallInterface::class) {
return $this->mockFirewall;
} elseif ($className === \TYPO3\Flow\Log\SecurityLoggerInterface::class) {
return $this->mockSecurityLogger;
}
return NULL;
}));
$this->inject($this->dispatcher, 'objectManager', $this->mockObjectManager);
}
示例12: resolveValidatorObjectNameCanResolveShortNamesOfBuiltInValidators
/**
* @test
*/
public function resolveValidatorObjectNameCanResolveShortNamesOfBuiltInValidators()
{
$this->mockObjectManager->expects($this->at(0))->method('get')->with('TYPO3\\Flow\\Reflection\\ReflectionService')->will($this->returnValue($this->mockReflectionService));
$this->mockObjectManager->expects($this->at(1))->method('isRegistered')->with('Foo')->will($this->returnValue(FALSE));
$this->mockObjectManager->expects($this->at(2))->method('isRegistered')->with('TYPO3\\Flow\\Validation\\Validator\\FooValidator')->will($this->returnValue(TRUE));
$this->mockReflectionService->expects($this->any())->method('getAllImplementationClassNamesForInterface')->with('TYPO3\\Flow\\Validation\\Validator\\ValidatorInterface')->will($this->returnValue(array('TYPO3\\Flow\\Validation\\Validator\\FooValidator')));
$this->assertSame('TYPO3\\Flow\\Validation\\Validator\\FooValidator', $this->validatorResolver->_call('resolveValidatorObjectName', 'Foo'));
}
示例13: parseSetsDefaultValueOfRoutePartsRecursively
/**
* @test
*/
public function parseSetsDefaultValueOfRoutePartsRecursively()
{
$this->route->setUriPattern('{foo.bar}');
$this->route->setRoutePartsConfiguration(array('foo.bar' => array('handler' => 'SomeRoutePartHandler')));
$this->route->setDefaults(array('foo' => array('bar' => 'SomeDefaultValue')));
$mockRoutePartHandler = $this->getMock(\TYPO3\Flow\Mvc\Routing\DynamicRoutePartInterface::class);
$mockRoutePartHandler->expects($this->once())->method('setDefaultValue')->with('SomeDefaultValue');
$this->mockObjectManager->expects($this->once())->method('get')->with('SomeRoutePartHandler')->will($this->returnValue($mockRoutePartHandler));
$this->route->parse();
}
示例14: setUp
/**
* @return void
*/
public function setUp()
{
$this->dispatchComponent = new DispatchComponent();
$this->mockComponentContext = $this->getMockBuilder('TYPO3\\Flow\\Http\\Component\\ComponentContext')->disableOriginalConstructor()->getMock();
$this->mockHttpRequest = $this->getMockBuilder('TYPO3\\Flow\\Http\\Request')->disableOriginalConstructor()->getMock();
$this->mockComponentContext->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->mockHttpRequest));
$this->mockHttpResponse = $this->getMockBuilder('TYPO3\\Flow\\Http\\Response')->disableOriginalConstructor()->getMock();
$this->mockComponentContext->expects($this->any())->method('getHttpResponse')->will($this->returnValue($this->mockHttpResponse));
$this->mockDispatcher = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Dispatcher')->getMock();
$this->inject($this->dispatchComponent, 'dispatcher', $this->mockDispatcher);
$this->mockActionRequest = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\ActionRequest')->disableOriginalConstructor()->getMock();
$this->mockObjectManager = $this->getMockBuilder('TYPO3\\Flow\\Object\\ObjectManagerInterface')->getMock();
$this->mockObjectManager->expects($this->any())->method('get')->with('TYPO3\\Flow\\Mvc\\ActionRequest', $this->mockHttpRequest)->will($this->returnValue($this->mockActionRequest));
$this->inject($this->dispatchComponent, 'objectManager', $this->mockObjectManager);
$this->mockSecurityContext = $this->getMockBuilder('TYPO3\\Flow\\Security\\Context')->getMock();
$this->inject($this->dispatchComponent, 'securityContext', $this->mockSecurityContext);
$this->mockPropertyMappingConfiguration = $this->getMockBuilder('TYPO3\\Flow\\Property\\PropertyMappingConfiguration')->disableOriginalConstructor()->getMock();
$this->inject($this->dispatchComponent, 'propertyMappingConfiguration', $this->mockPropertyMappingConfiguration);
$this->mockPropertyMapper = $this->getMockBuilder('TYPO3\\Flow\\Property\\PropertyMapper')->disableOriginalConstructor()->getMock();
$this->inject($this->dispatchComponent, 'propertyMapper', $this->mockPropertyMapper);
}
示例15: convertFromShouldThrowExceptionIfRequiredConstructorParameterWasNotFound
/**
* @test
* @expectedException \TYPO3\Flow\Property\Exception\InvalidTargetException
*/
public function convertFromShouldThrowExceptionIfRequiredConstructorParameterWasNotFound()
{
$source = array('propertyX' => 'bar');
$object = new ClassWithSettersAndConstructor('param1');
$convertedChildProperties = array('property2' => 'bar');
$this->mockReflectionService->expects($this->once())->method('hasMethod')->with(\TYPO3\Flow\Fixtures\ClassWithSettersAndConstructor::class, '__construct')->will($this->returnValue(true));
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with(\TYPO3\Flow\Fixtures\ClassWithSettersAndConstructor::class, '__construct')->will($this->returnValue(array('property1' => array('optional' => false, 'type' => null))));
$this->mockObjectManager->expects($this->once())->method('getClassNameByObjectName')->with(\TYPO3\Flow\Fixtures\ClassWithSettersAndConstructor::class)->will($this->returnValue(\TYPO3\Flow\Fixtures\ClassWithSettersAndConstructor::class));
$configuration = $this->buildConfiguration(array(PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true));
$result = $this->converter->convertFrom($source, \TYPO3\Flow\Fixtures\ClassWithSettersAndConstructor::class, $convertedChildProperties, $configuration);
$this->assertSame($object, $result);
}