Skip to content

Commit 11c3eea

Browse files
committed
Reduce the complexity proudly introduced (╯°□°)╯︵ ┻━┻
1 parent 162eb14 commit 11c3eea

File tree

1 file changed

+49
-49
lines changed

1 file changed

+49
-49
lines changed

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -389,65 +389,65 @@ public function testCreate($product)
389389
public function externalVideoDataProvider(): array
390390
{
391391
return [
392-
[
392+
'youtube-external-video' => [
393393
[
394-
[
395-
'media_type' => 'external-video',
396-
'disabled' => false,
397-
'label' => 'Test Video Created',
398-
'types' => [],
399-
'position' => 1,
400-
'content' => [
401-
'type' => 'image/png',
402-
'name' => 'thumbnail.png',
403-
'base64_encoded_data' => 'iVBORw0KGgoAAAANSUhEUgAAAP8AAADGCAMAAAAqo6adAAAAA1BMVEUAAP79f'
404-
. '+LBAAAASElEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
405-
. 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAA+BsYAAAF7hZJ0AAAAAElFTkSuQmCC',
394+
'media_type' => 'external-video',
395+
'disabled' => false,
396+
'label' => 'Test Video Created',
397+
'types' => [],
398+
'position' => 1,
399+
'content' => $this->getVideoThumbnailStub(),
400+
'extension_attributes' => [
401+
'video_content' => [
402+
'media_type' => 'external-video',
403+
'video_provider' => 'youtube',
404+
'video_url' => 'https://www.youtube.com/',
405+
'video_title' => 'Video title',
406+
'video_description' => 'Video description',
407+
'video_metadata' => 'Video meta',
406408
],
407-
'extension_attributes' => [
408-
'video_content' => [
409-
'media_type' => 'external-video',
410-
'video_provider' => 'youtube',
411-
'video_url' => 'https://www.youtube.com/',
412-
'video_title' => 'Video title',
413-
'video_description' => 'Video description',
414-
'video_metadata' => 'Video meta',
415-
],
416-
],
417-
]
409+
],
418410
]
419411
],
420-
[
412+
'vimeo-external-video' => [
421413
[
422-
[
423-
'media_type' => 'external-video',
424-
'disabled' => false,
425-
'label' => 'Test Video Updated',
426-
'types' => [],
427-
'position' => 1,
428-
'content' => [
429-
'type' => 'image/png',
430-
'name' => 'thumbnail.png',
431-
'base64_encoded_data' => 'iVBORw0KGgoAAAANSUhEUgAAAP8AAADGCAMAAAAqo6adAAAAA1BMVEUAAP79f'
432-
. '+LBAAAASElEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
433-
. 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAA+BsYAAAF7hZJ0AAAAAElFTkSuQmCC',
434-
],
435-
'extension_attributes' => [
436-
'video_content' => [
437-
'media_type' => 'external-video',
438-
'video_provider' => 'vimeo',
439-
'video_url' => 'https://www.vimeo.com/',
440-
'video_title' => 'Video title',
441-
'video_description' => 'Video description',
442-
'video_metadata' => 'Video meta',
443-
],
414+
'media_type' => 'external-video',
415+
'disabled' => false,
416+
'label' => 'Test Video Updated',
417+
'types' => [],
418+
'position' => 1,
419+
'content' => $this->getVideoThumbnailStub(),
420+
'extension_attributes' => [
421+
'video_content' => [
422+
'media_type' => 'external-video',
423+
'video_provider' => 'vimeo',
424+
'video_url' => 'https://www.vimeo.com/',
425+
'video_title' => 'Video title',
426+
'video_description' => 'Video description',
427+
'video_metadata' => 'Video meta',
444428
],
445-
]
429+
],
446430
]
447431
]
448432
];
449433
}
450434

435+
/**
436+
* Returns the array of data for Video thumbnail
437+
*
438+
* @return array|string[]
439+
*/
440+
private function getVideoThumbnailStub(): array
441+
{
442+
return [
443+
'type' => 'image/png',
444+
'name' => 'thumbnail.png',
445+
'base64_encoded_data' => 'iVBORw0KGgoAAAANSUhEUgAAAP8AAADGCAMAAAAqo6adAAAAA1BMVEUAAP79f'
446+
. '+LBAAAASElEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
447+
. 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAA+BsYAAAF7hZJ0AAAAAElFTkSuQmCC',
448+
];
449+
}
450+
451451
/**
452452
* Test create/ update product with external video media gallery entry
453453
*
@@ -463,7 +463,7 @@ public function testCreateWithExternalVideo(array $mediaGalleryData)
463463
]
464464
);
465465

466-
$simpleProductBaseData['media_gallery_entries'] = $mediaGalleryData;
466+
$simpleProductBaseData['media_gallery_entries'] = [$mediaGalleryData];
467467

468468
$response = $this->saveProduct($simpleProductBaseData);
469469
$this->assertEquals(

0 commit comments

Comments
 (0)