Neos\Neos\Tests\Unit\Fusion\ConvertUrisImplementationTest::evaluateReplaceExternalLinkTargets PHP Method

evaluateReplaceExternalLinkTargets() public method

This test checks that targets for external links are correctly replaced
    public function evaluateReplaceExternalLinkTargets()
    {
        $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);
        $this->mockWorkspace->expects($this->any())->method('getName')->will($this->returnValue('live'));
        $self = $this;
        $this->mockLinkingService->expects($this->atLeastOnce())->method('resolveNodeUri')->will($this->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 target="' . $externalLinkTarget . '" href="http://www.example.org">example</a> and one without a target <a target="' . $externalLinkTarget . '" href="http://www.example.org">example2</a>';
        $actualResult = $this->convertUrisImplementation->evaluate();
        $this->assertSame($expectedResult, $actualResult);
    }