Skip to content

Commit 6737341

Browse files
committed
Merge branch 'master3' of https://git.epam.com/magn-vid into ME-MAGETWO-QA
2 parents 202bbcb + 4951f2e commit 6737341

File tree

23 files changed

+168
-578
lines changed

23 files changed

+168
-578
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Attribute/Backend/Media.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,9 @@ public function duplicate($attributeId, $newFiles, $originalProductId, $newProdu
345345

346346
foreach ($this->getConnection()->fetchAll($select) as $row) {
347347
$row['value_id'] = $valueIdMap[$row['value_id']];
348+
unset($row['record_id']);
348349
$this->insertGalleryValueInStore($row);
350+
$this->bindValueToEntity($row['value_id'], $newProductId);
349351
}
350352

351353
return $this;

app/code/Magento/Catalog/Setup/UpgradeData.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,6 @@ public function __construct(CategorySetupFactory $categorySetupFactory)
4040
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
4141
{
4242
$setup->startSetup();
43-
if (version_compare($context->getVersion(), '2.0.1') < 0) {
44-
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
45-
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
46-
47-
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
48-
$attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
49-
50-
$attributeGroup = $categorySetup->getAttributeGroup(
51-
$entityTypeId,
52-
$attributeSetId,
53-
'Images',
54-
'attribute_group_name'
55-
);
56-
if (isset($attributeGroup['attribute_group_name']) && $attributeGroup['attribute_group_name'] == 'Images') {
57-
// update General Group
58-
$categorySetup->updateAttributeGroup(
59-
$entityTypeId,
60-
$attributeSetId,
61-
$attributeGroup['attribute_group_id'],
62-
'attribute_group_name',
63-
'Images and Videos'
64-
);
65-
}
66-
}
67-
6843
if ($context->getVersion()
6944
&& version_compare($context->getVersion(), '2.0.1') < 0
7045
) {

app/code/Magento/ProductVideo/Model/VideoExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class VideoExtractor implements \Magento\Framework\View\Xsd\Media\TypeDataExtrac
1212
/**
1313
* Media Entry type code
1414
*/
15-
const MEDIA_TYPE_CODE = 'image';
15+
const MEDIA_TYPE_CODE = 'video';
1616

1717
/**
1818
* Extract configuration data of videos from the DOM structure
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\ProductVideo\Setup;
8+
9+
use Magento\Catalog\Setup\CategorySetupFactory;
10+
use Magento\Framework\Setup\UpgradeDataInterface;
11+
use Magento\Framework\Setup\ModuleContextInterface;
12+
use Magento\Framework\Setup\ModuleDataSetupInterface;
13+
14+
/**
15+
* Upgrade Data script
16+
* @codeCoverageIgnore
17+
*/
18+
class UpgradeData implements UpgradeDataInterface
19+
{
20+
/**
21+
* Category setup factory
22+
*
23+
* @var CategorySetupFactory
24+
*/
25+
private $categorySetupFactory;
26+
27+
/**
28+
* Init
29+
*
30+
* @param CategorySetupFactory $categorySetupFactory
31+
*/
32+
public function __construct(CategorySetupFactory $categorySetupFactory)
33+
{
34+
$this->categorySetupFactory = $categorySetupFactory;
35+
}
36+
37+
/**
38+
* {@inheritdoc}
39+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
40+
*/
41+
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
42+
{
43+
$setup->startSetup();
44+
if (version_compare($context->getVersion(), '2.0.0.2') < 0) {
45+
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
46+
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
47+
48+
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
49+
$attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
50+
51+
$attributeGroup = $categorySetup->getAttributeGroup(
52+
$entityTypeId,
53+
$attributeSetId,
54+
'Image Management'
55+
);
56+
if (isset($attributeGroup['attribute_group_name']) && $attributeGroup['attribute_group_name'] == 'Image Management') {
57+
// update General Group
58+
$categorySetup->updateAttributeGroup(
59+
$entityTypeId,
60+
$attributeSetId,
61+
$attributeGroup['attribute_group_id'],
62+
'attribute_group_name',
63+
'Images and Videos'
64+
);
65+
}
66+
67+
}
68+
69+
$setup->endSetup();
70+
}
71+
}

app/code/Magento/ProductVideo/Test/Unit/Block/Adminhtml/Product/Edit/NewVideoTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ class NewVideoTest extends \PHPUnit_Framework_TestCase
3737
*/
3838
protected $jsonEncoderMock;
3939

40+
/**
41+
* @var \Magento\ProductVideo\Helper\Media|\PHPUnit_Framework_MockObject_MockObject
42+
*/
43+
protected $mediaHelper;
44+
4045
/**
4146
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
4247
* |\Magento\ProductVideo\Block\Adminhtml\Product\Edit\NewVideo
@@ -46,6 +51,7 @@ class NewVideoTest extends \PHPUnit_Framework_TestCase
4651
public function setUp()
4752
{
4853
$this->contextMock = $this->getMock('\Magento\Backend\Block\Template\Context', [], [], '', false);
54+
$this->mediaHelper = $this->getMock('\Magento\ProductVideo\Helper\Media', [], [], '', false);
4955
$this->mathRandom = $this->getMock('\Magento\Framework\Math\Random', [], [], '', false);
5056
$this->urlBuilder = $this->getMock('\Magento\Framework\UrlInterface', [], [], '', false);
5157
$this->contextMock->expects($this->any())->method('getMathRandom')->willReturn($this->mathRandom);
@@ -60,9 +66,11 @@ public function setUp()
6066
'\Magento\ProductVideo\Block\Adminhtml\Product\Edit\NewVideo',
6167
[
6268
'context' => $this->contextMock,
69+
'mediaHelper' => $this->mediaHelper,
70+
'urlBuilder' => $this->urlBuilder,
71+
'jsonEncoder' => $this->jsonEncoderMock,
6372
'registry' => $this->registryMock,
6473
'formFactory' => $this->formFactoryMock,
65-
'jsonEncoder' => $this->jsonEncoderMock
6674
]
6775
);
6876
}

app/code/Magento/ProductVideo/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_ProductVideo" setup_version="2.0.0.1">
9+
<module name="Magento_ProductVideo" setup_version="2.0.0.2">
1010
<sequence>
1111
<module name="Magento_Catalog"/>
1212
<module name="Magento_Backend"/>

app/code/Magento/ProductVideo/etc/view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ProductVideo/etc/view.xsd">
8+
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
99
<media>
1010
<videos module="Magento_ProductVideo">
1111
<video id="play_if_base" type="play_if_base">

app/code/Magento/Swatches/etc/view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Catalog/etc/view.xsd">
8+
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
99
<media>
1010
<images module="Magento_Catalog">
1111
<image id="swatch_image" type="swatch_image">

app/design/adminhtml/Magento/backend/etc/view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Catalog/etc/view.xsd">
8+
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
99
<vars module="Js_Bundle">
1010
<var name="bundle_size">1MB</var>
1111
</vars>

app/design/adminhtml/Magento/backend/etc/view.xsd

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)