From 535beceda3416d37d566b54112e19801c60fffcb Mon Sep 17 00:00:00 2001 From: Guido Schmechel Date: Thu, 30 May 2024 12:51:18 +0200 Subject: [PATCH] [TASK] Add v13 support --- Tests/Unit/Helper/SoundcloudHelperTest.php | 38 ++++++------------- .../Unit/Rendering/SoundcloudRendererTest.php | 28 +++++--------- 2 files changed, 21 insertions(+), 45 deletions(-) diff --git a/Tests/Unit/Helper/SoundcloudHelperTest.php b/Tests/Unit/Helper/SoundcloudHelperTest.php index 8cde9e9..32462c3 100644 --- a/Tests/Unit/Helper/SoundcloudHelperTest.php +++ b/Tests/Unit/Helper/SoundcloudHelperTest.php @@ -5,6 +5,8 @@ namespace Ayacoo\AyacooSoundcloud\Tests\Unit\Helper; use Ayacoo\AyacooSoundcloud\Helper\SoundcloudHelper; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Resource\File; use TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOEmbedHelper; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -22,18 +24,14 @@ protected function setUp(): void $this->subject = new SoundcloudHelper('soundcloud'); } - /** - * @test - */ + #[Test] public function isAbstractOEmbedHelper(): void { self::assertInstanceOf(AbstractOEmbedHelper::class, $this->subject); } - /** - * @test - * @dataProvider handleSoundcloudTitleDataProvider - */ + #[Test] + #[DataProvider('handleSoundcloudTitleDataProvider')] public function handleSoundcloudTitleReturnsFilteredTitle(string $input, string $expected) { $params = [$input]; @@ -66,9 +64,7 @@ public static function handleSoundcloudTitleDataProvider(): array ]; } - /** - * @test - */ + #[Test] public function getOEmbedUrlWithJsonFormat(): void { $mediaId = 'user/song'; @@ -81,9 +77,7 @@ public function getOEmbedUrlWithJsonFormat(): void self::assertEquals($expectedUrl, $actualUrl); } - /** - * @test - */ + #[Test] public function getOEmbedUrlWithXmlFormat(): void { $mediaId = 'user/another-song'; @@ -97,10 +91,8 @@ public function getOEmbedUrlWithXmlFormat(): void self::assertEquals($expectedUrl, $actualUrl); } - /** - * @test - * @dataProvider getAudioIdDataProvider - */ + #[Test] + #[DataProvider('getAudioIdDataProvider')] public function getAudioIdWithValidUrlReturnsAudioIdOrNull(string $url, mixed $expectedAudioId) { $params = [$url]; @@ -122,9 +114,7 @@ public static function getAudioIdDataProvider(): array ]; } - /** - * @test - */ + #[Test] public function getOEmbedDataWithEmbedDataReturnsOptimizedArray() { $fileResourceMock = $this->createMock(File::class); @@ -166,9 +156,7 @@ public function getOEmbedDataWithEmbedDataReturnsOptimizedArray() self::assertSame($expected, $result); } - /** - * @test - */ + #[Test] public function getOEmbedDataWithoutEmbedDataReturnsEmptyArray() { $fileResourceMock = $this->createMock(File::class); @@ -190,9 +178,7 @@ public function getOEmbedDataWithoutEmbedDataReturnsEmptyArray() self::assertSame([], $result); } - /** - * @test - */ + #[Test] public function getPublicUrlReturnsPublicUrl() { $fileResourceMock = $this->createMock(File::class); diff --git a/Tests/Unit/Rendering/SoundcloudRendererTest.php b/Tests/Unit/Rendering/SoundcloudRendererTest.php index 6c70a43..e2a0851 100644 --- a/Tests/Unit/Rendering/SoundcloudRendererTest.php +++ b/Tests/Unit/Rendering/SoundcloudRendererTest.php @@ -7,6 +7,8 @@ use Ayacoo\AyacooSoundcloud\Event\ModifySoundcloudOutputEvent; use Ayacoo\AyacooSoundcloud\Helper\SoundcloudHelper; use Ayacoo\AyacooSoundcloud\Rendering\SoundcloudRenderer; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Psr\EventDispatcher\EventDispatcherInterface; use TYPO3\CMS\Core\Resource\File; use TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface; @@ -34,17 +36,13 @@ protected function setUp(): void $this->subject = new SoundcloudRenderer($eventDispatcherMock, $configurationManagerMock); } - /** - * @test - */ + #[Test] public function hasFileRendererInterface(): void { self::assertInstanceOf(FileRendererInterface::class, $this->subject); } - /** - * @test - */ + #[Test] public function canRenderWithMatchingMimeTypeReturnsTrue(): void { $GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['onlineMediaHelpers']['soundcloud'] = SoundcloudHelper::class; @@ -57,9 +55,7 @@ public function canRenderWithMatchingMimeTypeReturnsTrue(): void self::assertTrue($result); } - /** - * @test - */ + #[Test] public function canRenderWithMatchingMimeTypeReturnsFalse(): void { $fileResourceMock = $this->createMock(File::class); @@ -70,10 +66,8 @@ public function canRenderWithMatchingMimeTypeReturnsFalse(): void self::assertFalse($result); } - /** - * @test - * @dataProvider getPrivacySettingWithExistingConfigReturnsBooleanDataProvider - */ + #[Test] + #[DataProvider('getPrivacySettingWithExistingConfigReturnsBooleanDataProvider')] public function getPrivacySettingWithExistingConfigReturnsBoolean(array $pluginConfig, bool $expected) { $eventDispatcherMock = $this->getMockBuilder(EventDispatcherInterface::class)->getMock(); @@ -132,9 +126,7 @@ public static function getPrivacySettingWithExistingConfigReturnsBooleanDataProv ]; } - /** - * @test - */ + #[Test] public function renderReturnsSoundcloudHtml(): void { $iframe = '