diff --git a/Classes/Rendering/SoundcloudRenderer.php b/Classes/Rendering/SoundcloudRenderer.php index 5220500..8eac104 100644 --- a/Classes/Rendering/SoundcloudRenderer.php +++ b/Classes/Rendering/SoundcloudRenderer.php @@ -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) { diff --git a/Tests/Unit/Helper/SoundcloudHelperTest.php b/Tests/Unit/Helper/SoundcloudHelperTest.php index f63f7c8..8cde9e9 100644 --- a/Tests/Unit/Helper/SoundcloudHelperTest.php +++ b/Tests/Unit/Helper/SoundcloudHelperTest.php @@ -45,6 +45,7 @@ public function handleSoundcloudTitleReturnsFilteredTitle(string $input, string public static function handleSoundcloudTitleDataProvider(): array { + $maxLengthText = self::generateRandomString(300); return [ 'No filter needed' => [ 'Test', @@ -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), ], ]; } @@ -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); + } }