Commit 33f1f91c authored by Benni Mack's avatar Benni Mack Committed by Georg Ringer
Browse files

[TASK] Add tests for BackendUtility::splitTable_Uid

Resolves: #84855
Releases: master
Change-Id: I20c189b082c616590bcb2bdabff9e2f2c22a1bce
Reviewed-on: https://review.typo3.org/56793

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 1bcc8fbc
......@@ -222,7 +222,7 @@ class BackendUtility
/**
* Makes an backwards explode on the $str and returns an array with ($table, $uid).
* Example: tt_content_45 => array('tt_content', 45)
* Example: tt_content_45 => ['tt_content', 45]
*
* @param string $str [tablename]_[uid] string to explode
* @return array
......
......@@ -1212,4 +1212,32 @@ class BackendUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
$computedProperties = BackendUtility::purgeComputedPropertiesFromRecord($record);
self::assertSame($expected, $computedProperties);
}
public function splitTableUidDataProvider()
{
return [
'simple' => [
'pages_23',
['pages', '23']
],
'complex' => [
'tt_content_13',
['tt_content', '13']
],
'multiple underscores' => [
'tx_runaway_domain_model_crime_scene_1234',
['tx_runaway_domain_model_crime_scene', '1234']
]
];
}
/**
* @test
* @dataProvider splitTableUidDataProvider
*/
public function splitTableUid($input, $expected)
{
$result = BackendUtility::splitTable_Uid($input);
self::assertSame($expected, $result);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment