diff --git a/Classes/Fusion/ConvertEmailLinksImplementation.php b/Classes/Fusion/ConvertEmailLinksImplementation.php index 8351214..5fdee90 100644 --- a/Classes/Fusion/ConvertEmailLinksImplementation.php +++ b/Classes/Fusion/ConvertEmailLinksImplementation.php @@ -50,7 +50,7 @@ public function evaluate() return $text; } if (!is_string($text)) { - throw new Exception(sprintf('Only strings can be processed by this TypoScript object, given: "%s".', gettype($text)), 1409659552); + throw new Exception(sprintf('Only strings can be processed by this Fusion object, given: "%s".', gettype($text)), 1409659552); } $currentContext = $this->getRuntime()->getCurrentContext(); $node = $currentContext['node']; diff --git a/Tests/Unit/Fusion/ConvertEmailLinksImplementationTest.php b/Tests/Unit/Fusion/ConvertEmailLinksImplementationTest.php index b8f445e..bd9c40f 100644 --- a/Tests/Unit/Fusion/ConvertEmailLinksImplementationTest.php +++ b/Tests/Unit/Fusion/ConvertEmailLinksImplementationTest.php @@ -45,9 +45,9 @@ class ConvertEmailLinksImplementationTest extends UnitTestCase */ protected $mockNode; - public function setUp() + public function setUp(): void { - $this->convertEmailLinks = $this->getAccessibleMock(ConvertEmailLinksImplementation::class, ['getValue'], [], '', false); + $this->convertEmailLinks = $this->getAccessibleMock(ConvertEmailLinksImplementation::class, ['fusionValue'], [], '', false); $this->mockContext = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(); $this->mockContext->expects($this->any())->method('getWorkspaceName')->will($this->returnValue('live')); @@ -63,7 +63,6 @@ public function setUp() $linkNameConverter->setReplacementString(' (at) '); $this->convertEmailLinks->_set('linkNameConverter', $linkNameConverter); $this->convertEmailLinks->_set('mailToHrefConverter', new Mailto2HrefObfuscatingConverter(15)); - } /** @@ -72,13 +71,20 @@ public function setUp() */ public function emailsAreConverted($rawText, $expectedText) { - $this->convertEmailLinks->expects($this->atLeastOnce())->method('getValue')->will($this->returnValue($rawText)); + $this->convertEmailLinks + ->expects(self::atLeastOnce()) + ->method('fusionValue') + ->will($this->returnValueMap([ + ['value', $rawText], + ['patternMailTo', '/(href=")mailto:([^"]*)/'], + ['patternMailDisplay', '/(href="mailto:[^>]*>)([^<]*)/'] + ])); $actualResult = $this->convertEmailLinks->evaluate(); $this->assertSame($expectedText, $actualResult); } - public function emailTexts() + public function emailTexts(): array { return [ 'just some text not to touch' => [