Skip to content

Commit

Permalink
Reduce the complexity proudly introduced (╯°□°)╯︵ ┻━┻
Browse files Browse the repository at this point in the history
  • Loading branch information
lbajsarowicz committed Mar 25, 2020
1 parent 162eb14 commit 11c3eea
Showing 1 changed file with 49 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,65 +389,65 @@ public function testCreate($product)
public function externalVideoDataProvider(): array
{
return [
[
'youtube-external-video' => [
[
[
'media_type' => 'external-video',
'disabled' => false,
'label' => 'Test Video Created',
'types' => [],
'position' => 1,
'content' => [
'type' => 'image/png',
'name' => 'thumbnail.png',
'base64_encoded_data' => 'iVBORw0KGgoAAAANSUhEUgAAAP8AAADGCAMAAAAqo6adAAAAA1BMVEUAAP79f'
. '+LBAAAASElEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
. 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAA+BsYAAAF7hZJ0AAAAAElFTkSuQmCC',
'media_type' => 'external-video',
'disabled' => false,
'label' => 'Test Video Created',
'types' => [],
'position' => 1,
'content' => $this->getVideoThumbnailStub(),
'extension_attributes' => [
'video_content' => [
'media_type' => 'external-video',
'video_provider' => 'youtube',
'video_url' => 'https://www.youtube.com/',
'video_title' => 'Video title',
'video_description' => 'Video description',
'video_metadata' => 'Video meta',
],
'extension_attributes' => [
'video_content' => [
'media_type' => 'external-video',
'video_provider' => 'youtube',
'video_url' => 'https://www.youtube.com/',
'video_title' => 'Video title',
'video_description' => 'Video description',
'video_metadata' => 'Video meta',
],
],
]
],
]
],
[
'vimeo-external-video' => [
[
[
'media_type' => 'external-video',
'disabled' => false,
'label' => 'Test Video Updated',
'types' => [],
'position' => 1,
'content' => [
'type' => 'image/png',
'name' => 'thumbnail.png',
'base64_encoded_data' => 'iVBORw0KGgoAAAANSUhEUgAAAP8AAADGCAMAAAAqo6adAAAAA1BMVEUAAP79f'
. '+LBAAAASElEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
. 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAA+BsYAAAF7hZJ0AAAAAElFTkSuQmCC',
],
'extension_attributes' => [
'video_content' => [
'media_type' => 'external-video',
'video_provider' => 'vimeo',
'video_url' => 'https://www.vimeo.com/',
'video_title' => 'Video title',
'video_description' => 'Video description',
'video_metadata' => 'Video meta',
],
'media_type' => 'external-video',
'disabled' => false,
'label' => 'Test Video Updated',
'types' => [],
'position' => 1,
'content' => $this->getVideoThumbnailStub(),
'extension_attributes' => [
'video_content' => [
'media_type' => 'external-video',
'video_provider' => 'vimeo',
'video_url' => 'https://www.vimeo.com/',
'video_title' => 'Video title',
'video_description' => 'Video description',
'video_metadata' => 'Video meta',
],
]
],
]
]
];
}

/**
* Returns the array of data for Video thumbnail
*
* @return array|string[]
*/
private function getVideoThumbnailStub(): array
{
return [
'type' => 'image/png',
'name' => 'thumbnail.png',
'base64_encoded_data' => 'iVBORw0KGgoAAAANSUhEUgAAAP8AAADGCAMAAAAqo6adAAAAA1BMVEUAAP79f'
. '+LBAAAASElEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
. 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAA+BsYAAAF7hZJ0AAAAAElFTkSuQmCC',
];
}

/**
* Test create/ update product with external video media gallery entry
*
Expand All @@ -463,7 +463,7 @@ public function testCreateWithExternalVideo(array $mediaGalleryData)
]
);

$simpleProductBaseData['media_gallery_entries'] = $mediaGalleryData;
$simpleProductBaseData['media_gallery_entries'] = [$mediaGalleryData];

$response = $this->saveProduct($simpleProductBaseData);
$this->assertEquals(
Expand Down

0 comments on commit 11c3eea

Please sign in to comment.