From 2ce9981737c744eef597667bdbfaf538ca415d46 Mon Sep 17 00:00:00 2001 From: Volker Kemeter Date: Thu, 25 Jan 2024 13:49:14 +0100 Subject: [PATCH] [TASK] add tests to YouTubeProcessor --- Tests/DataProcessing/YoutubeProcessorTest.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Tests/DataProcessing/YoutubeProcessorTest.php b/Tests/DataProcessing/YoutubeProcessorTest.php index 5de891a..cd148de 100644 --- a/Tests/DataProcessing/YoutubeProcessorTest.php +++ b/Tests/DataProcessing/YoutubeProcessorTest.php @@ -24,12 +24,18 @@ public function testFileReferences(): void [$id, $root, $previewUrl, $storage, $cObj, $embedUrl, $preview] = $this->createShared(); $fileRepo = $this->createMock(FileRepository::class); - $ref = $this->createMock(FileReference::class); - $ref->expects(static::any())->method('getContents')->willReturn($id); - $ref->expects(static::any())->method('getMimeType')->willReturn('video/youtube'); + + $ref1 = $this->createMock(FileReference::class); + $ref1->expects(static::any())->method('getContents')->willReturn($id); + $ref1->expects(static::any())->method('getMimeType')->willReturn('video/youtube'); + + $ref2 = $this->createMock(FileReference::class); + $ref2->expects(static::never())->method('getContents'); + $ref2->expects(static::any())->method('getMimeType')->willReturn('image/png'); + $refencesField = 'assets'; $config['referencesField'] = $refencesField; - $processedData = [$refencesField => [$ref]]; + $processedData = [$refencesField => [$ref1, $ref2]]; Environment::initialize( new ApplicationContext('Testing'), @@ -51,7 +57,7 @@ public function testFileReferences(): void $expected = array_merge($processedData, [ 'videos' => [ [ - 'reference' => $ref, + 'reference' => $ref1, 'preview' => $preview, 'id' => $id, 'url' => $embedUrl . $id,