Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/field-layout-v8' into bug…
Browse files Browse the repository at this point in the history
…fix/field-layout-v8

# Conflicts:
#	Tests/Unit/ViewHelpers/FieldViewHelperTest.php
  • Loading branch information
romm committed Sep 29, 2017
2 parents fbde4d8 + f221822 commit 58d299e
Showing 1 changed file with 35 additions and 34 deletions.
69 changes: 35 additions & 34 deletions Tests/Unit/ViewHelpers/FieldViewHelperTest.php
Expand Up @@ -323,15 +323,22 @@ public function originalArgumentsAreRestoredAfterViewHelperIsRendered()

if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '8.0.0', '<')) {
$renderingContextMock->injectTemplateVariableContainer($templateVariableContainer);
} else {
$renderingContextMock->setVariableProvider($templateVariableContainer);
}

$templateVariables = [];
$viewHelper->setRenderingContext($renderingContextMock);

$templateVariableContainerProphecy
->add(Argument::type('string'), Argument::any())
->shouldBeCalled()
->will(function ($arguments) use ($templateVariableContainerProphecy, &$templateVariables) {
$templateVariables[$arguments[0]] = $arguments[1];
$arguments = [];
$templateVariables = [];

$templateVariableContainerProphecy
->add(Argument::type('string'), Argument::any())
->shouldBeCalled()
->will(function ($arguments) use ($templateVariableContainerProphecy, &$templateVariables) {
$templateVariables[$arguments[0]] = $arguments[1];

if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '8.0.0', '<')) {
if (in_array($arguments[0], FieldViewHelper::$reservedVariablesNames)) {
$templateVariableContainerProphecy
->remove($arguments[0])
Expand All @@ -340,34 +347,28 @@ public function originalArgumentsAreRestoredAfterViewHelperIsRendered()
unset($templateVariables[$arguments[0]]);
});
}

$templateVariableContainerProphecy
->exists($arguments[0])
->willReturn(true);

$templateVariableContainerProphecy
->get($arguments[0])
->willReturn($arguments[1]);
});

$templateVariableContainerProphecy
->getAllIdentifiers()
->will(function () use (&$templateVariables) {
return array_keys($templateVariables);
});

$templateVariableContainerProphecy
->getAll()
->will(function () use (&$templateVariables) {
return $templateVariables;
});
} else {
$renderingContextMock->setVariableProvider($templateVariableContainer);
}

$viewHelper->setRenderingContext($renderingContextMock);

$arguments = [];
}

$templateVariableContainerProphecy
->exists($arguments[0])
->willReturn(true);

$templateVariableContainerProphecy
->get($arguments[0])
->willReturn($arguments[1]);
});

$templateVariableContainerProphecy
->getAllIdentifiers()
->will(function () use (&$templateVariables) {
return array_keys($templateVariables);
});

$templateVariableContainerProphecy
->getAll()
->will(function () use (&$templateVariables) {
return $templateVariables;
});

$templateVariableContainer->add('foo', 'bar');
foreach (FieldViewHelper::$reservedVariablesNames as $key) {
Expand Down

0 comments on commit 58d299e

Please sign in to comment.