N°4913 - Avoid object initials to overflow in medallions

This commit is contained in:
Molkobain
2022-03-06 22:43:10 +01:00
parent e3586cff65
commit cd7f9e478f
6 changed files with 53 additions and 5 deletions

View File

@@ -554,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