Skip to content

Commit

Permalink
Merge pull request #3606 from markusguenther/bugfix/repair-converturi…
Browse files Browse the repository at this point in the history
…-unittest

BUGFIX: Fix disablingSetNoOpenerWorks test for convertUri
  • Loading branch information
mhsdesign committed Feb 29, 2024
2 parents 67abc65 + 316e00b commit 8fffb57
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 8fffb57

Please sign in to comment.