/** * @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)); }
/** * @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)); }
/** * @test */ public function getTypeOfChildPropertyReturnsCorrectTypeIfThatPropertyIsPubliclyPresent() { $configuration = new PropertyMappingConfiguration(); $actual = $this->converter->getTypeOfChildProperty(\TYPO3\Flow\Tests\Functional\Property\Fixtures\TestClass::class, 'somePublicProperty', $configuration); $this->assertEquals('float', $actual); }