mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 16:48:42 +02:00
N°7385 - Trigger on mention executed even if it's not a mention with @ (#638)
This commit is contained in:
@@ -645,66 +645,6 @@ class utilsTest extends ItopTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider GetMentionedObjectsFromTextProvider
|
||||
* @covers utils::GetMentionedObjectsFromText
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function testGetMentionedObjectsFromText($sInput, $aExceptedMentionedObjects)
|
||||
{
|
||||
// Emulate the "Case provider mechanism" (reason: the data provider requires utils constants not available before the application startup)
|
||||
echo "testGetMentionedObjectsFromText: input = $sInput\n";
|
||||
$aTestedMentionedObjects = utils::GetMentionedObjectsFromText($sInput);
|
||||
|
||||
$sExpectedAsString = print_r($aExceptedMentionedObjects, true);
|
||||
$sTestedAsString = print_r($aTestedMentionedObjects, true);
|
||||
|
||||
$this->assertEquals($sExpectedAsString, $sTestedAsString, "Found mentioned objects don't match. Got: $sTestedAsString, expected $sExpectedAsString");
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public function GetMentionedObjectsFromTextProvider(): array
|
||||
{
|
||||
$sAbsUrlAppRoot = utils::GetAbsoluteUrlAppRoot();
|
||||
|
||||
return [
|
||||
'No object' => [
|
||||
"Begining
|
||||
Second line
|
||||
End",
|
||||
[],
|
||||
],
|
||||
'1 UserRequest' => [
|
||||
<<<HTML
|
||||
<p>Beginning</p><p>Before link <a data-role="object-mention" data-object-class="UserRequest" data-object-key="12345" data-object-id="#Test Ticket" href="$sAbsUrlAppRoot/pages/UI.php?operation=details&class=UserRequest&id=12345">#Test Ticket</a>After link</p><p>End</p>
|
||||
HTML,
|
||||
[
|
||||
'UserRequest' => ['12345'],
|
||||
],
|
||||
],
|
||||
'2 UserRequests' => [
|
||||
<<<HTML
|
||||
<div class="ibo-activity-entry--main-information-content"><p>Beginning</p><p>Before link <a data-role="object-mention" data-object-class="UserRequest" data-object-key="12345" data-object-id="#Test Ticket 1" href="$sAbsUrlAppRoot/pages/UI.php?operation=details&class=UserRequest&id=12345">#Test Ticket</a> After link</p><p>And <a data-role="object-mention" data-object-class="UserRequest" data-object-key="987654" data-object-id="#Test Ticket 2" href="$sAbsUrlAppRoot/pages/UI.php?operation=details&class=UserRequest&id=987654">#Test Ticket</a></p><p>End</p></div>
|
||||
HTML,
|
||||
[
|
||||
'UserRequest' => ['12345', '987654'],
|
||||
],
|
||||
],
|
||||
'1 UserRequest, 1 Person' => [
|
||||
<<<HTML
|
||||
<div class="ibo-activity-entry--main-information-content"><div class="ibo-activity-entry--main-information-content"><p>Beginning</p><p>Before link <a data-role="object-mention" data-object-class="UserRequest" data-object-key="12345" data-object-id="#Test Ticket" href="$sAbsUrlAppRoot/pages/UI.php?operation=details&class=UserRequest&id=12345">#Test Ticket</a> After link</p><p>And <a data-role="object-mention" data-object-class="Person" data-object-id="@Agatha Christie" data-object-key="3" data-object-id="@Agatha Christie" href="$sAbsUrlAppRoot/pages/UI.php?operation=details&class=Person&id=3">@Agatha Christie</a></p><p>End</p></div></div>
|
||||
HTML,
|
||||
[
|
||||
'UserRequest' => ['12345'],
|
||||
'Person' => ['3'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider FormatInitialsForMedallionProvider
|
||||
* @covers utils::FormatInitialsForMedallion
|
||||
|
||||
Reference in New Issue
Block a user