Example #1
0
 /**
  * @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\FLOW3\Property\PropertyMappingConfiguration();
     $configuration->setTypeConverterOptions('TYPO3\\FLOW3\\Property\\TypeConverter\\ObjectConverter', array());
     $this->assertEquals('TheTypeOfSubObject', $this->converter->getTypeOfChildProperty('TheTargetType', 'thePropertyName', $configuration));
 }
Example #2
0
 /**
  * Sets up this test case
  */
 public function setUp()
 {
     $this->identityRoutePart = $this->getAccessibleMock('TYPO3\\FLOW3\\Mvc\\Routing\\IdentityRoutePart', array('createPathSegmentForObject'));
     $this->mockPersistenceManager = $this->getMock('TYPO3\\FLOW3\\Persistence\\PersistenceManagerInterface');
     $this->identityRoutePart->_set('persistenceManager', $this->mockPersistenceManager);
     $this->mockReflectionService = $this->getMock('TYPO3\\FLOW3\\Reflection\\ReflectionService');
     $this->mockClassSchema = $this->getMock('TYPO3\\FLOW3\\Reflection\\ClassSchema', 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\\FLOW3\\Mvc\\Routing\\ObjectPathMappingRepository');
     $this->identityRoutePart->_set('objectPathMappingRepository', $this->mockObjectPathMappingRepository);
 }
Example #3
0
 /**
  * @test
  */
 public function getAvailableCommandsReturnsAllAvailableCommands()
 {
     $commandManager = new CommandManager();
     $commandManager->injectReflectionService($this->mockReflectionService);
     $mockCommandControllerClassNames = array('TYPO3\\FLOW3\\Tests\\Unit\\Cli\\Fixtures\\Command\\MockACommandController', 'TYPO3\\FLOW3\\Tests\\Unit\\Cli\\Fixtures\\Command\\MockBCommandController');
     $this->mockReflectionService->expects($this->once())->method('getAllSubClassNamesForClass')->with('TYPO3\\FLOW3\\Cli\\CommandController')->will($this->returnValue($mockCommandControllerClassNames));
     $commands = $commandManager->getAvailableCommands();
     $this->assertEquals(3, count($commands));
     $this->assertEquals('typo3.flow3.tests.unit.cli.fixtures:mocka:foo', $commands[0]->getCommandIdentifier());
     $this->assertEquals('typo3.flow3.tests.unit.cli.fixtures:mocka:bar', $commands[1]->getCommandIdentifier());
     $this->assertEquals('typo3.flow3.tests.unit.cli.fixtures:mockb:baz', $commands[2]->getCommandIdentifier());
 }
Example #4
0
 /**
  * @test
  */
 public function resolveValidatorObjectNameCanResolveShortNamesOfBuiltInValidators()
 {
     $this->mockObjectManager->expects($this->at(0))->method('isRegistered')->with('Foo')->will($this->returnValue(FALSE));
     $this->mockObjectManager->expects($this->at(1))->method('isRegistered')->with('TYPO3\\FLOW3\\Validation\\Validator\\FooValidator')->will($this->returnValue(TRUE));
     $this->mockReflectionService->expects($this->atLeastOnce())->method('isClassImplementationOf')->with('TYPO3\\FLOW3\\Validation\\Validator\\FooValidator', 'TYPO3\\FLOW3\\Validation\\Validator\\ValidatorInterface')->will($this->returnValue(TRUE));
     $this->assertSame('TYPO3\\FLOW3\\Validation\\Validator\\FooValidator', $this->validatorResolver->_call('resolveValidatorObjectName', 'Foo'));
 }