Skip to content

Commit

Permalink
[TASK] add tests to YouTubeProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
Volker Kemeter committed Jan 25, 2024
1 parent 4b23b0b commit 2ce9981
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Tests/DataProcessing/YoutubeProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -51,7 +57,7 @@ public function testFileReferences(): void
$expected = array_merge($processedData, [
'videos' => [
[
'reference' => $ref,
'reference' => $ref1,
'preview' => $preview,
'id' => $id,
'url' => $embedUrl . $id,
Expand Down

0 comments on commit 2ce9981

Please sign in to comment.