diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php
index 739cf3b65..5c4e620a4 100644
--- a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php
+++ b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php
@@ -13,13 +13,6 @@ class AttributeDefinitionTest extends ItopDataTestCase
{
public const CREATE_TEST_ORG = true;
- protected function setUp(): void
- {
- parent::setUp();
- require_once(APPROOT.'core/attributedef.class.inc.php');
-
- }
-
public function testGetImportColumns()
{
$oAttributeDefinition = MetaModel::GetAttributeDef("ApplicationSolution", "status");
diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeTextTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeTextTest.php
new file mode 100644
index 000000000..00373af17
--- /dev/null
+++ b/tests/php-unit-tests/unitary-tests/core/AttributeTextTest.php
@@ -0,0 +1,78 @@
+oTestOrganizationForAttributeText = $this->CreateOrganization('Test for AttributeTextTest');
+ }
+
+ /**
+ * @covers AttributeText::RenderWikiHtml
+ */
+ public function testRenderWikiHtml_nonWikiUrlVariants()
+ {
+ // String value
+ $input = 'This hyperlink https://combodo.com should be in an anchor tag.';
+ $expected = 'This hyperlink https://combodo.com should be in an anchor tag.';
+ $this->assertEquals($expected, AttributeText::RenderWikiHtml($input));
+
+ // Empty string value
+ $this->assertEquals('', AttributeText::RenderWikiHtml(''));
+
+ // Null value
+ $this->assertEquals('', AttributeText::RenderWikiHtml(null));
+ }
+
+ /**
+ * @covers AttributeText::RenderWikiHtml
+ */
+ public function testRenderWikiHtml_bWikiOnlyAbsentOrFalse_shouldTransformBothRegularAndWikiHyperlinks()
+ {
+ $input = 'A regular hyperlink https://combodo.com and a wiki hyperlink to an existing object [[Organization:'.$this->oTestOrganizationForAttributeText->GetKey().']]';
+
+ // bWikiOnly default value
+ $result = AttributeText::RenderWikiHtml($input);
+ $this->assertStringContainsString('', $result);
+ $this->assertStringContainsString('class="object-ref-link"', $result);
+
+ // bWikiOnly = false
+ $result = AttributeText::RenderWikiHtml($input, false);
+ $this->assertStringContainsString('', $result);
+ $this->assertStringContainsString('class="object-ref-link"', $result);
+ }
+
+ /**
+ * @covers AttributeText::RenderWikiHtml
+ */
+ public function testRenderWikiHtml_bWikiOnlyToTrue_shouldNotTransformRegularHyperlinkButTransformWikiHyperlink()
+ {
+ $input = 'A regular hyperlink https://combodo.com and a wiki hyperlink to an existing object [[Organization:'.$this->oTestOrganizationForAttributeText->GetKey().']]';
+ $result = AttributeText::RenderWikiHtml($input, true);
+ $this->assertStringNotContainsString('', $result);
+ $this->assertStringContainsString('class="object-ref-link"', $result);
+ }
+
+ /**
+ * @covers AttributeText::RenderWikiHtml
+ */
+ public function testRenderWikiHtml_shouldTransformWikiHyperlinkForExistingObjectsOnly()
+ {
+ $input = 'A wiki hyperlink to a non existing object [[Organization:123456789]] and a wiki hyperlink to an existing object [[Organization:'.$this->oTestOrganizationForAttributeText->GetKey().']]';
+ $result = AttributeText::RenderWikiHtml($input);
+ $this->assertStringContainsString('wiki_broken_link', $result);
+ $this->assertStringContainsString('class="object-ref-link"', $result);
+ }
+}