Skip to content

Commit

Permalink
Merge branch '4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
albe committed Mar 17, 2020
2 parents 048f040 + 46458de commit c511353
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Classes/Core/Model/ProcessingRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ class ProcessingRule
protected $dataType;

/**
* @Flow\Inject
* @var \Neos\Flow\Property\PropertyMappingConfiguration
*/
protected $propertyMappingConfiguration;

/**
* @Flow\Inject
* @var \Neos\Flow\Validation\Validator\ConjunctionValidator
*/
protected $validator;
Expand All @@ -58,6 +56,8 @@ class ProcessingRule
*/
public function __construct()
{
$this->propertyMappingConfiguration = new \Neos\Flow\Property\PropertyMappingConfiguration();
$this->validator = new \Neos\Flow\Validation\Validator\ConjunctionValidator();
$this->processingMessages = new Result();
}

Expand Down
6 changes: 5 additions & 1 deletion Classes/Finishers/RedirectFinisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ public function executeInternal()

$uriParts = parse_url($uri);
if (!isset($uriParts['scheme']) || $uriParts['scheme'] === '') {
$uri = $this->baseUriProvider->getConfiguredBaseUriOrFallbackToCurrentRequest() . $uri;
$uri = sprintf(
'%s/%s',
rtrim($this->baseUriProvider->getConfiguredBaseUriOrFallbackToCurrentRequest(, '/'),
ltrim($uri, '/')
);
}

$escapedUri = htmlentities($uri, ENT_QUOTES, 'utf-8');
Expand Down
17 changes: 6 additions & 11 deletions Tests/Unit/Core/Model/ProcessingRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ class ProcessingRuleTest extends UnitTestCase
public function setUp(): void
{
$this->mockPropertyMapper = $this->getMockBuilder(PropertyMapper::class)->getMock();
$this->processingRule = $this->getAccessibleMock(ProcessingRule::class, ['dummy']);
/** @noinspection PhpUndefinedMethodInspection */
$this->processingRule->_set('propertyMapper', $this->mockPropertyMapper);
/** @noinspection PhpUndefinedMethodInspection */
$this->processingRule->_set('validator', new ConjunctionValidator());
/** @noinspection PhpUndefinedMethodInspection */
$this->processingRule->_set('processingMessages', new Result());

$this->processingRule = new ProcessingRule();

$this->inject($this->processingRule, 'propertyMapper', $this->mockPropertyMapper);
}

/**
Expand Down Expand Up @@ -126,11 +123,9 @@ public function processDoesNotConvertValueIfTargetTypeIsNotSpecified()
public function processConvertsValueIfDataTypeIsSpecified()
{
$this->processingRule->setDataType('SomeDataType');
$mockPropertyMappingConfiguration = $this->getMockBuilder(PropertyMappingConfiguration::class)->getMock();
/** @noinspection PhpUndefinedMethodInspection */
$this->processingRule->_set('propertyMappingConfiguration', $mockPropertyMappingConfiguration);
$propertyMappingConfiguration = $this->processingRule->getPropertyMappingConfiguration();

$this->mockPropertyMapper->expects($this->once())->method('convert')->with('Some Value', 'SomeDataType', $mockPropertyMappingConfiguration)->will($this->returnValue('Converted Value'));
$this->mockPropertyMapper->expects($this->once())->method('convert')->with('Some Value', 'SomeDataType', $propertyMappingConfiguration)->will($this->returnValue('Converted Value'));
$this->mockPropertyMapper->expects($this->any())->method('getMessages')->will($this->returnValue(new Result()));
Assert::assertEquals('Converted Value', $this->processingRule->process('Some Value'));
}
Expand Down

0 comments on commit c511353

Please sign in to comment.