Neos\Flow\Tests\Unit\Property\PropertyMapperTest::findTypeConverterShouldReturnConverterForTargetObjectIfItExists PHP Method

findTypeConverterShouldReturnConverterForTargetObjectIfItExists() public method

public findTypeConverterShouldReturnConverterForTargetObjectIfItExists ( $targetClass, $expectedTypeConverter, $typeConverters, $shouldFailWithException = false )
    public function findTypeConverterShouldReturnConverterForTargetObjectIfItExists($targetClass, $expectedTypeConverter, $typeConverters, $shouldFailWithException = false)
    {
        $propertyMapper = $this->getAccessibleMock(PropertyMapper::class, ['dummy']);
        $propertyMapper->_set('typeConverters', ['string' => $typeConverters]);
        try {
            $actualTypeConverter = $propertyMapper->_call('findTypeConverter', 'someSourceString', $targetClass, $this->mockConfiguration);
            if ($shouldFailWithException) {
                $this->fail('Expected exception ' . $shouldFailWithException . ' which was not thrown.');
            }
            $this->assertSame($expectedTypeConverter, $actualTypeConverter->_name);
        } catch (\Exception $e) {
            if ($shouldFailWithException === false) {
                throw $e;
            }
            $this->assertInstanceOf($shouldFailWithException, $e);
        }
    }