-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-70606: [Backport] - [GITHUB] Simple product videos display th…
…e thumbnail image rather than the embedded video player. #6360 - for 2.1
- Loading branch information
1 parent
cd6c087
commit ed1c05c
Showing
8 changed files
with
97 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
app/code/Magento/ConfigurableProduct/Test/Unit/Plugin/Product/Media/GalleryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\ConfigurableProduct\Test\Unit\Block\Plugin\Product\Media; | ||
|
||
use Magento\ConfigurableProduct\Block\Plugin\Product\Media\Gallery; | ||
use Magento\Catalog\Model\Product; | ||
|
||
/** | ||
* Class GalleryTest | ||
*/ | ||
class GalleryTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
public function testAfterGetOptions() | ||
{ | ||
$jsonMock = $this->createJsonMock(); | ||
$productMock = $this->createProductMock(); | ||
$galleryMock = $this->createGalleryMock(); | ||
$variationProductMock = $this->createProductMock(); | ||
$configurableTypeMock = $this->createConfigurableTypeMock(); | ||
|
||
$resultJson = '[]'; | ||
$variationProductId = 1; | ||
$expectedGalleryJson = [ | ||
$variationProductId => [ | ||
[ | ||
'mediaType' => 'type', | ||
'videoUrl' => 'url', | ||
'isBase' => true | ||
] | ||
] | ||
]; | ||
$image = new \Magento\Framework\DataObject( | ||
['media_type' => 'type', 'video_url' => 'url', 'file' => 'image.jpg'] | ||
); | ||
|
||
$galleryMock->expects(($this->any()))->method('getProduct')->willReturn($productMock); | ||
$productMock->expects($this->once())->method('getTypeId')->willReturn('configurable'); | ||
$productMock->expects($this->once())->method('getTypeInstance')->willReturn($configurableTypeMock); | ||
$configurableTypeMock->expects($this->once())->method('getUsedProducts')->with($productMock) | ||
->willReturn([$variationProductMock]); | ||
$variationProductMock->expects($this->once())->method('getId')->willReturn($variationProductId); | ||
$variationProductMock->expects($this->once())->method('getMediaGalleryImages')->willReturn([$image]); | ||
$variationProductMock->expects($this->once())->method('getImage')->willReturn('image.jpg'); | ||
|
||
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); | ||
$plugin = $helper->getObject(Gallery::class); | ||
$result = $plugin->afterGetOptionsMediaGalleryDataJson($galleryMock, $resultJson); | ||
$this->assertEquals(json_encode($expectedGalleryJson), $result); | ||
} | ||
|
||
/** | ||
* @return \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private function createJsonMock() | ||
{ | ||
return $this->getMockBuilder(Json::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
} | ||
|
||
/** | ||
* @return \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private function createProductMock() | ||
{ | ||
return $this->getMockBuilder(Product::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
} | ||
|
||
/** | ||
* @return \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private function createGalleryMock() | ||
{ | ||
return $this->getMockBuilder(\Magento\Catalog\Block\Product\View\Gallery::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
} | ||
|
||
/** | ||
* @return \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private function createConfigurableTypeMock() | ||
{ | ||
return $this->getMockBuilder(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
lib/internal/Magento/Framework/Serialize/JsonValidator.php
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
lib/internal/Magento/Framework/Serialize/Serializer/Base64Json.php
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
lib/internal/Magento/Framework/Serialize/Serializer/Json.php
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
lib/internal/Magento/Framework/Serialize/SerializerInterface.php
This file was deleted.
Oops, something went wrong.