Skip to content

Commit

Permalink
[TASK] Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ayacoo committed Feb 18, 2024
1 parent c71dd1d commit cb6cb6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Classes/Rendering/SoundcloudRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ protected function getPrivacySetting(): bool
$extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(
ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT
);
$extSettings = $extbaseFrameworkConfiguration['plugin.']['tx_ayacoosoundcloud.'];
if (isset($extSettings)) {
$privacy = (bool)$extSettings['settings.']['privacy'] ?? false;
$extSettings = $extbaseFrameworkConfiguration['plugin.']['tx_ayacoosoundcloud.']['settings.'] ?? null;
if (is_array($extSettings)) {
$privacy = (bool)$extSettings['privacy'] ?? false;
}
return $privacy;
} catch (InvalidConfigurationTypeException) {
Expand Down
16 changes: 10 additions & 6 deletions Tests/Unit/Helper/SoundcloudHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function handleSoundcloudTitleReturnsFilteredTitle(string $input, string

public static function handleSoundcloudTitleDataProvider(): array
{
$maxLengthText = self::generateRandomString(300);
return [
'No filter needed' => [
'Test',
Expand All @@ -59,12 +60,8 @@ public static function handleSoundcloudTitleDataProvider(): array
'Test',
],
'MaxLength' => [
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lore',
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata',
$maxLengthText,
substr($maxLengthText, 0, 255),
],
];
}
Expand Down Expand Up @@ -225,4 +222,11 @@ private function buildReflectionForProtectedFunction(string $methodName, array $
$method->setAccessible(true);
return $method->invokeArgs($this->subject, $params);
}

private static function generateRandomString(int $size): string
{
$bytes = random_bytes($size);
$randomString = bin2hex($bytes);
return substr($randomString, 0, $size);
}
}

0 comments on commit cb6cb6d

Please sign in to comment.