mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 17:18:51 +02:00
N°5547 - Object deletion fails if friendlyname too long (#529)
This commit is contained in:
@@ -1133,6 +1133,54 @@ class DBObjectTest extends ItopDataTestCase
|
||||
return $oPerson;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for test deletion
|
||||
* N°5547 - Object deletion fails if friendlyname too long
|
||||
*
|
||||
* @return array data
|
||||
*/
|
||||
public function getDeletionLongValueProvider()
|
||||
{
|
||||
return [
|
||||
'friendlyname longer than 255 chracters with smiley' => [
|
||||
'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq',
|
||||
'😁😂🤣😃😄😅😆😗🥰😘😍😎😋😊😉😙😚',
|
||||
],
|
||||
'the same friendlyname in other order with error before fix 5547 ' => [
|
||||
'😁😂🤣😃😄😅😆😗🥰😘😍😎😋😊😉😙😚',
|
||||
'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* N°5547 - Object deletion fails if friendlyname too long
|
||||
*
|
||||
* @covers DBObject::DBIncrement
|
||||
*
|
||||
* @dataProvider getDeletionLongValueProvider
|
||||
*
|
||||
*/
|
||||
public function testDeletionLongValue(string $sName, string $sFirstName)
|
||||
{
|
||||
// Create a UserRequest with 2 contacts
|
||||
$oPerson = MetaModel::NewObject('Person', [
|
||||
'name' => $sName,
|
||||
'first_name' => $sFirstName,
|
||||
'org_id' => 1,
|
||||
]);
|
||||
$oPerson->DBWrite();
|
||||
|
||||
$bDeletionOK = true;
|
||||
try {
|
||||
$oDeletionPlan = $oPerson->DBDelete();
|
||||
}
|
||||
catch (CoreException $e) {
|
||||
$bDeletionOK = false;
|
||||
}
|
||||
$this->assertTrue($bDeletionOK);
|
||||
}
|
||||
|
||||
public function ResetReloadCount()
|
||||
{
|
||||
$this->aReloadCount = [];
|
||||
@@ -1211,8 +1259,14 @@ class DBObjectTest extends ItopDataTestCase
|
||||
$fTotalDuration = microtime(true) - $fStart;
|
||||
echo 'Total duration: '.sprintf('%.3f s', $fTotalDuration)."\n\n";
|
||||
}
|
||||
|
||||
public function CheckLongValueInAttributeProvider() {
|
||||
/**
|
||||
* Data provider for test deletion
|
||||
* N°5547 - Object deletion fails if friendlyname too long
|
||||
*
|
||||
* @return array data
|
||||
*/
|
||||
public function DeletionLongValueProvider()
|
||||
{
|
||||
return [
|
||||
// UserRequest.title is an AttributeString (maxsize = 255)
|
||||
'title 250 chars' => ['title', 250],
|
||||
@@ -1234,11 +1288,9 @@ class DBObjectTest extends ItopDataTestCase
|
||||
/**
|
||||
* Test check long field with non ascii characters
|
||||
*
|
||||
* @covers DBObject::Set
|
||||
* @covers DBObject::CheckToWrite
|
||||
* @covers DBObject::SetTrim
|
||||
* @covers DBObject::DBDelete
|
||||
*
|
||||
* @dataProvider CheckLongValueInAttributeProvider
|
||||
* @dataProvider DeletionLongValueProvider
|
||||
*
|
||||
* @since 3.1.2 N°3448 - Framework field size check not correctly implemented for multi-bytes languages/strings
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user