diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeTextTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeTextTest.php index a84d5b897..40a7a1f67 100644 --- a/tests/php-unit-tests/unitary-tests/core/AttributeTextTest.php +++ b/tests/php-unit-tests/unitary-tests/core/AttributeTextTest.php @@ -1,4 +1,5 @@ https://combodo.com should be in an anchor tag.'; - $this->assertEquals($sExpected, AttributeText::RenderWikiHtml($sInput)); + * @covers AttributeText::RenderWikiHtml + */ + public function testRenderWikiHtml_nonWikiUrlVariants() + { + // String value + $sInput = 'This hyperlink https://combodo.com should be in an anchor tag.'; + $sExpected = 'This hyperlink https://combodo.com should be in an anchor tag.'; + $this->assertEquals($sExpected, AttributeText::RenderWikiHtml($sInput)); - // Empty string value - $this->assertEquals('', AttributeText::RenderWikiHtml('')); + // Empty string value + $this->assertEquals('', AttributeText::RenderWikiHtml('')); - // Null value - $this->assertEquals('', AttributeText::RenderWikiHtml(null)); - } + // Null value + $this->assertEquals('', AttributeText::RenderWikiHtml(null)); + } - /** - * @covers AttributeText::RenderWikiHtml - */ - public function testRenderWikiHtml_bWikiOnlyAbsentOrFalse_shouldTransformBothRegularAndWikiHyperlinks() - { - $sInput = 'A regular hyperlink https://combodo.com and a wiki hyperlink to an existing object [[Organization:'.$this->oTestOrganizationForAttributeText->GetKey().']]'; + /** + * @covers AttributeText::RenderWikiHtml + */ + public function testRenderWikiHtml_bWikiOnlyAbsentOrFalse_shouldTransformBothRegularAndWikiHyperlinks() + { + $sInput = 'A regular hyperlink https://combodo.com and a wiki hyperlink to an existing object [[Organization:'.$this->oTestOrganizationForAttributeText->GetKey().']]'; // bWikiOnly default value - $sResult = AttributeText::RenderWikiHtml($sInput); - $this->assertStringContainsString('', $sResult); - $this->assertStringContainsString('class="object-ref-link"', $sResult); + $sResult = AttributeText::RenderWikiHtml($sInput); + $this->assertStringContainsString('', $sResult); + $this->assertStringContainsString('class="object-ref-link"', $sResult); // bWikiOnly = false - $sResult = AttributeText::RenderWikiHtml($sInput, false); - $this->assertStringContainsString('', $sResult); - $this->assertStringContainsString('class="object-ref-link"', $sResult); - } + $sResult = AttributeText::RenderWikiHtml($sInput, false); + $this->assertStringContainsString('', $sResult); + $this->assertStringContainsString('class="object-ref-link"', $sResult); + } - /** - * @covers AttributeText::RenderWikiHtml - */ - public function testRenderWikiHtml_bWikiOnlyToTrue_shouldNotTransformRegularHyperlinkButTransformWikiHyperlink() - { - $sInput = 'A regular hyperlink https://combodo.com and a wiki hyperlink to an existing object [[Organization:'.$this->oTestOrganizationForAttributeText->GetKey().']]'; - $sResult = AttributeText::RenderWikiHtml($sInput, true); - $this->assertStringNotContainsString('', $sResult); - $this->assertStringContainsString('class="object-ref-link"', $sResult); - } + /** + * @covers AttributeText::RenderWikiHtml + */ + public function testRenderWikiHtml_bWikiOnlyToTrue_shouldNotTransformRegularHyperlinkButTransformWikiHyperlink() + { + $sInput = 'A regular hyperlink https://combodo.com and a wiki hyperlink to an existing object [[Organization:'.$this->oTestOrganizationForAttributeText->GetKey().']]'; + $sResult = AttributeText::RenderWikiHtml($sInput, true); + $this->assertStringNotContainsString('', $sResult); + $this->assertStringContainsString('class="object-ref-link"', $sResult); + } - /** - * @covers AttributeText::RenderWikiHtml - */ - public function testRenderWikiHtml_shouldTransformWikiHyperlinkForExistingObjectsOnly() - { - $sInput = 'A wiki hyperlink to a non existing object [[Organization:123456789]] and a wiki hyperlink to an existing object [[Organization:'.$this->oTestOrganizationForAttributeText->GetKey().']]'; - $sResult = AttributeText::RenderWikiHtml($sInput); - $this->assertStringContainsString('wiki_broken_link', $sResult); - $this->assertStringContainsString('class="object-ref-link"', $sResult); - } + /** + * @covers AttributeText::RenderWikiHtml + */ + public function testRenderWikiHtml_shouldTransformWikiHyperlinkForExistingObjectsOnly() + { + $sInput = 'A wiki hyperlink to a non existing object [[Organization:123456789]] and a wiki hyperlink to an existing object [[Organization:'.$this->oTestOrganizationForAttributeText->GetKey().']]'; + $sResult = AttributeText::RenderWikiHtml($sInput); + $this->assertStringContainsString('wiki_broken_link', $sResult); + $this->assertStringContainsString('class="object-ref-link"', $sResult); + } }