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


PHP ReflectionService::expects方法代码示例

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


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

示例1: getTypeOfChildPropertyShouldUseReflectionServiceToDetermineType

 /**
  * @test
  */
 public function getTypeOfChildPropertyShouldUseReflectionServiceToDetermineType()
 {
     $this->mockReflectionService->expects($this->any())->method('hasMethod')->with('TheTargetType', 'setThePropertyName')->will($this->returnValue(FALSE));
     $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with('TheTargetType', '__construct')->will($this->returnValue(array('thePropertyName' => array('type' => 'TheTypeOfSubObject', 'elementType' => NULL))));
     $configuration = new \TYPO3\Flow\Property\PropertyMappingConfiguration();
     $configuration->setTypeConverterOptions(\TYPO3\Flow\Property\TypeConverter\ObjectConverter::class, array());
     $this->assertEquals('TheTypeOfSubObject', $this->converter->getTypeOfChildProperty('TheTargetType', 'thePropertyName', $configuration));
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:11,代码来源:ObjectConverterTest.php

示例2: setUp

 public function setUp()
 {
     $this->commandController = $this->getAccessibleMock('TYPO3\\Flow\\Cli\\CommandController', array('resolveCommandMethodName', 'callCommandMethod'));
     $this->mockReflectionService = $this->getMockBuilder('TYPO3\\Flow\\Reflection\\ReflectionService')->disableOriginalConstructor()->getMock();
     $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->will($this->returnValue(array()));
     $this->inject($this->commandController, 'reflectionService', $this->mockReflectionService);
     $this->mockConsoleOutput = $this->getMockBuilder('TYPO3\\Flow\\Cli\\ConsoleOutput')->disableOriginalConstructor()->getMock();
     $this->inject($this->commandController, 'output', $this->mockConsoleOutput);
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:9,代码来源:CommandControllerTest.php

示例3: getTypeOfChildPropertyShouldRemoveLeadingBackslashesForAnnotationParameters

 /**
  * @test
  */
 public function getTypeOfChildPropertyShouldRemoveLeadingBackslashesForAnnotationParameters()
 {
     $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with('TheTargetType', '__construct')->will($this->returnValue(array()));
     $this->mockReflectionService->expects($this->any())->method('hasMethod')->with('TheTargetType', 'setThePropertyName')->will($this->returnValue(false));
     $this->mockReflectionService->expects($this->any())->method('getClassPropertyNames')->with('TheTargetType')->will($this->returnValue(array('thePropertyName')));
     $this->mockReflectionService->expects($this->any())->method('getPropertyTagValues')->with('TheTargetType', 'thePropertyName')->will($this->returnValue(array('\\TheTypeOfSubObject')));
     $configuration = new \TYPO3\Flow\Property\PropertyMappingConfiguration();
     $configuration->setTypeConverterOptions(\TYPO3\Flow\Property\TypeConverter\ObjectConverter::class, array());
     $this->assertEquals('TheTypeOfSubObject', $this->converter->getTypeOfChildProperty('TheTargetType', 'thePropertyName', $configuration));
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:13,代码来源:ObjectConverterTest.php

示例4: 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);
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:14,代码来源:NodeFactoryTest.php

示例5: 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);
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:14,代码来源:NodeFactoryTest.php

示例6: getAvailableCommandsReturnsAllAvailableCommands

 /**
  * @test
  */
 public function getAvailableCommandsReturnsAllAvailableCommands()
 {
     $commandManager = new CommandManager();
     $commandManager->injectReflectionService($this->mockReflectionService);
     $mockCommandControllerClassNames = array(\TYPO3\Flow\Tests\Unit\Cli\Fixtures\Command\MockACommandController::class, \TYPO3\Flow\Tests\Unit\Cli\Fixtures\Command\MockBCommandController::class);
     $this->mockReflectionService->expects($this->once())->method('getAllSubClassNamesForClass')->with(\TYPO3\Flow\Cli\CommandController::class)->will($this->returnValue($mockCommandControllerClassNames));
     $commands = $commandManager->getAvailableCommands();
     $this->assertEquals(3, count($commands));
     $this->assertEquals('typo3.flow.tests.unit.cli.fixtures:mocka:foo', $commands[0]->getCommandIdentifier());
     $this->assertEquals('typo3.flow.tests.unit.cli.fixtures:mocka:bar', $commands[1]->getCommandIdentifier());
     $this->assertEquals('typo3.flow.tests.unit.cli.fixtures:mockb:baz', $commands[2]->getCommandIdentifier());
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:15,代码来源:CommandManagerTest.php

示例7: setUp

 /**
  * Sets up this test case
  */
 public function setUp()
 {
     $this->identityRoutePart = $this->getAccessibleMock(\TYPO3\Flow\Mvc\Routing\IdentityRoutePart::class, array('createPathSegmentForObject'));
     $this->mockPersistenceManager = $this->getMock(\TYPO3\Flow\Persistence\PersistenceManagerInterface::class);
     $this->identityRoutePart->_set('persistenceManager', $this->mockPersistenceManager);
     $this->mockReflectionService = $this->getMock(\TYPO3\Flow\Reflection\ReflectionService::class);
     $this->mockClassSchema = $this->getMock(\TYPO3\Flow\Reflection\ClassSchema::class, array(), array(), '', false);
     $this->mockReflectionService->expects($this->any())->method('getClassSchema')->will($this->returnValue($this->mockClassSchema));
     $this->identityRoutePart->_set('reflectionService', $this->mockReflectionService);
     $this->mockObjectPathMappingRepository = $this->getMock(\TYPO3\Flow\Mvc\Routing\ObjectPathMappingRepository::class);
     $this->identityRoutePart->_set('objectPathMappingRepository', $this->mockObjectPathMappingRepository);
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:15,代码来源:IdentityRoutePartTest.php

示例8: quotedArgumentValuesAreCorrectlyParsedWhenPassingTheCommandAsString

 /**
  * @test
  * @dataProvider quotedValues
  */
 public function quotedArgumentValuesAreCorrectlyParsedWhenPassingTheCommandAsString($quotedArgument, $expectedResult)
 {
     $methodParameters = array('requiredArgument1' => array('optional' => FALSE, 'type' => 'string'), 'requiredArgument2' => array('optional' => FALSE, 'type' => 'string'));
     $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Acme\\Test\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
     $expectedArguments = array('requiredArgument1' => 'firstArgumentValue', 'requiredArgument2' => $expectedResult);
     $request = $this->requestBuilder->build('acme.test:default:list firstArgumentValue ' . $quotedArgument);
     $this->assertEquals($expectedArguments, $request->getArguments());
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:12,代码来源:RequestBuilderTest.php

示例9: resolveValidatorObjectNameCallsGetValidatorType

 /**
  * @test
  */
 public function resolveValidatorObjectNameCallsGetValidatorType()
 {
     $mockObjectManager = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface');
     $mockObjectManager->expects($this->any())->method('get')->with('TYPO3\\Flow\\Reflection\\ReflectionService')->will($this->returnValue($this->mockReflectionService));
     $this->mockReflectionService->expects($this->any())->method('getAllImplementationClassNamesForInterface')->with('TYPO3\\Flow\\Validation\\Validator\\ValidatorInterface')->will($this->returnValue(array()));
     $validatorResolver = $this->getAccessibleMock('TYPO3\\Flow\\Validation\\ValidatorResolver', array('getValidatorType'));
     $validatorResolver->_set('objectManager', $mockObjectManager);
     $validatorResolver->expects($this->once())->method('getValidatorType')->with('someDataType');
     $validatorResolver->_call('resolveValidatorObjectName', 'someDataType');
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:13,代码来源:ValidatorResolverTest.php

示例10: 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);
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:16,代码来源:PersistentObjectConverterTest.php

示例11: prepareArgumentsRegistersAnnotationBasedArgumentsWithoutDescriptionIfDebugModeIsDisabled

 /**
  * @test
  */
 public function prepareArgumentsRegistersAnnotationBasedArgumentsWithoutDescriptionIfDebugModeIsDisabled()
 {
     \TYPO3\Fluid\Fluid::$debugMode = FALSE;
     $dataCacheMock = $this->getMock('TYPO3\\Flow\\Cache\\Frontend\\VariableFrontend', array(), array(), '', FALSE);
     $dataCacheMock->expects($this->any())->method('has')->will($this->returnValue(TRUE));
     $dataCacheMock->expects($this->any())->method('get')->will($this->returnValue(array()));
     $viewHelper = new \TYPO3\Fluid\Core\Fixtures\TestViewHelper2();
     $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('TYPO3\\Fluid\\Core\\Fixtures\\TestViewHelper2', 'render')->will($this->returnValue($this->fixtureMethodParameters));
     $this->mockReflectionService->expects($this->never())->method('getMethodTagsValues');
     $viewHelper->injectObjectManager($this->mockObjectManager);
     $expected = array('param1' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param1', 'integer', '', TRUE, NULL, TRUE), 'param2' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param2', 'array', '', TRUE, NULL, TRUE), 'param3' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param3', 'string', '', FALSE, 'default', TRUE));
     $this->assertEquals($expected, $viewHelper->prepareArguments(), 'Annotation based arguments were not registered.');
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:16,代码来源:AbstractViewHelperTest.php

示例12: prepareArgumentsRegistersAnnotationBasedArgumentsWithoutDescriptionIfDebugModeIsDisabled

 /**
  * @test
  */
 public function prepareArgumentsRegistersAnnotationBasedArgumentsWithoutDescriptionIfDebugModeIsDisabled()
 {
     \TYPO3\Fluid\Fluid::$debugMode = false;
     $dataCacheMock = $this->getMockBuilder(\TYPO3\Flow\Cache\Frontend\VariableFrontend::class)->disableOriginalConstructor()->getMock();
     $dataCacheMock->expects($this->any())->method('has')->will($this->returnValue(true));
     $dataCacheMock->expects($this->any())->method('get')->will($this->returnValue(array()));
     $viewHelper = new \TYPO3\Fluid\Core\Fixtures\TestViewHelper2();
     $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with(\TYPO3\Fluid\Core\Fixtures\TestViewHelper2::class, 'render')->will($this->returnValue($this->fixtureMethodParameters));
     $this->mockReflectionService->expects($this->never())->method('getMethodTagsValues');
     $viewHelper->injectObjectManager($this->mockObjectManager);
     $expected = array('param1' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param1', 'integer', '', true, null, true), 'param2' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param2', 'array', '', true, null, true), 'param3' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param3', 'string', '', false, 'default', true));
     $this->assertEquals($expected, $viewHelper->prepareArguments(), 'Annotation based arguments were not registered.');
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:16,代码来源:AbstractViewHelperTest.php


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