/**
  * @test
  */
 public function convertFromUsesAppropriatePropertyPopulationMethodsInOrderConstructorSetterPublic()
 {
     $convertedObject = $this->converter->convertFrom('irrelevant', \TYPO3\Flow\Tests\Functional\Property\Fixtures\TestClass::class, array('propertyMeantForConstructorUsage' => 'theValue', 'propertyMeantForSetterUsage' => 'theValue', 'propertyMeantForPublicUsage' => 'theValue'), new PropertyMappingConfiguration());
     $this->assertEquals('theValue set via Constructor', ObjectAccess::getProperty($convertedObject, 'propertyMeantForConstructorUsage', true));
     $this->assertEquals('theValue set via Setter', ObjectAccess::getProperty($convertedObject, 'propertyMeantForSetterUsage', true));
     $this->assertEquals('theValue', ObjectAccess::getProperty($convertedObject, 'propertyMeantForPublicUsage', true));
 }
 /**
  * @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));
 }
 /**
  * All properties in the source array except __identity are sub-properties.
  *
  * @param mixed $source
  * @return array
  */
 public function getSourceChildPropertiesToBeConverted($source)
 {
     if (is_string($source)) {
         return array();
     }
     if (isset($source['__identity'])) {
         unset($source['__identity']);
     }
     return parent::getSourceChildPropertiesToBeConverted($source);
 }
 /**
  * @test
  * @expectedException \TYPO3\Flow\Property\Exception\InvalidTargetException
  */
 public function convertFromThrowsMeaningfulExceptionWhenTheTargetExpectsAnUnknownDependencyThatIsNotSpecifiedInTheSource()
 {
     $this->converter->convertFrom('irrelevant', \TYPO3\Flow\Tests\Functional\Property\Fixtures\TestClassWithThirdPartyClassConstructorInjection::class);
 }