Merge remote-tracking branch 'origin/support/3.0' into develop

This commit is contained in:
Molkobain
2022-03-07 12:54:13 +01:00
65 changed files with 457 additions and 217 deletions

View File

@@ -434,7 +434,7 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
public function testToAcronym(string $sInput, string $sExceptedAcronym)
{
$sTestedAcronym = utils::ToAcronym($sInput);
$this->assertEquals($sTestedAcronym, $sExceptedAcronym, "Acronym for '$sInput' doesn't match. Got '$sTestedAcronym', expected '$sExceptedAcronym'.");
$this->assertEquals($sExceptedAcronym, $sTestedAcronym, "Acronym for '$sInput' doesn't match. Got '$sTestedAcronym', expected '$sExceptedAcronym'.");
}
/**
@@ -479,6 +479,10 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
'Jada Pinkett-smith',
'JP',
],
'Several words, cyrillic alphabet' => [
'Денис Александра',
'ДА',
],
];
}
@@ -550,6 +554,40 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
];
}
/**
* @dataProvider FormatInitialsForMedallionProvider
* @covers utils::FormatInitialsForMedallion
*
* @param string $sInput
* @param string $sExpected
*/
public function testFormatInitialsForMedallion(string $sInput, string $sExpected)
{
$sTested = utils::FormatInitialsForMedallion($sInput);
$this->assertEquals($sExpected, $sTested);
}
/**
* @since 3.0.1
*/
public function FormatInitialsForMedallionProvider()
{
return [
'All letters kept (2)' => [
'AB',
'AB',
],
'All letters kept (3)' => [
'ABC',
'ABC',
],
'Only 3 first letters kept (4)' => [
'ABCD',
'ABC',
],
];
}
/**
* @param string $sExpressionToConvert
* @param int $iExpectedConvertedValue