Skip to content

Commit

Permalink
BUGFIX: Fix disablingSetNoOpenerWorks test for convertUri
Browse files Browse the repository at this point in the history
Fixes the disablingSetNoOpenerWorks test for the convertUri. Now the test respects the value of setNoOpener.

fixes: #3605
  • Loading branch information
markusguenther authored and mhsdesign committed Feb 29, 2024
1 parent 1d59d93 commit 316e00b
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Neos.Neos/Tests/Unit/Fusion/ConvertUrisImplementationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,24 @@ public function evaluateReplaceResourceLinkTargets()
*/
public function disablingSetNoOpenerWorks()
{
$value = 'This string contains an external link: <a href="http://www.example.org">example3</a>';
$this->addValueExpectation($value, null, false, '_blank', null, false, false);
$expectedResult = 'This string contains an external link: <a href="http://www.example.org">example3</a>';
$nodeIdentifier = 'aeabe76a-551a-495f-a324-ad9a86b2aff7';
$externalLinkTarget = '_blank';

$value = 'This string contains a link to a node: <a href="node://' . $nodeIdentifier . '">node</a> and one to an external url with a target set <a target="top" href="http://www.example.org">example</a> and one without a target <a href="http://www.example.org">example2</a>';
$this->addValueExpectation($value, null, false, $externalLinkTarget, null, false, false);

$this->mockWorkspace->expects(self::any())->method('getName')->will(self::returnValue('live'));

$self = $this;
$this->mockLinkingService->expects(self::atLeastOnce())->method('resolveNodeUri')->will(self::returnCallback(function ($nodeUri) use ($self, $nodeIdentifier) {
if ($nodeUri === 'node://' . $nodeIdentifier) {
return 'http://localhost/uri/01';
} else {
$self->fail('Unexpected node URI "' . $nodeUri . '"');
}
}));

$expectedResult = 'This string contains a link to a node: <a href="http://localhost/uri/01">node</a> and one to an external url with a target set <a rel="external" target="top" href="http://www.example.org">example</a> and one without a target <a target="' . $externalLinkTarget . '" rel="external" href="http://www.example.org">example2</a>';
$actualResult = $this->convertUrisImplementation->evaluate();
self::assertSame($expectedResult, $actualResult);
}
Expand Down

0 comments on commit 316e00b

Please sign in to comment.