Skip to content

Commit aaa8291

Browse files
committed
Merge pull request #319 from magento-goinc/MAGETWO-37718
[MX][Virtual Team, GoInc] Public GitHub Issues, Bug Fixes
2 parents 4f8cc5c + 473655c commit aaa8291

File tree

30 files changed

+938
-637
lines changed

30 files changed

+938
-637
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Refactored controller actions in the Product area
1010
* Moved commands cache.php, indexer.php, log.php, test.php, compiler.php, singletenant\_compiler.php, generator.php, pack.php, deploy.php and file\_assembler.php to the new bin/magento CLI framework
1111
* Data Migration Tool
12-
* The Data Migraiton Tool is published in the separate [repository](https://github.com/magento/data-migration-tool-ce, "Data Migration Tool repository")
12+
* The Data Migraiton Tool is published in the separate [repository](https://github.com/magento/data-migration-tool-ce "Data Migration Tool repository")
1313
* Fixed bugs
1414
* Fixed an issue where error appeared during placing order with virtual product
1515
* Fixed an issue where billing and shipping sections didn't contain address information on order print

app/code/Magento/Bundle/CustomerData/BundleItem.php

-47
This file was deleted.

app/code/Magento/Bundle/composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"magento/framework": "0.74.0-beta9",
1919
"magento/module-quote": "0.74.0-beta9",
2020
"magento/module-media-storage": "0.74.0-beta9",
21-
"magento/module-msrp": "0.74.0-beta9",
2221
"magento/magento-composer-installer": "*"
2322
},
2423
"suggest": {

app/code/Magento/Bundle/etc/frontend/di.xml

-7
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,4 @@
1616
</argument>
1717
</arguments>
1818
</type>
19-
<type name="Magento\Checkout\CustomerData\ItemPoolInterface">
20-
<arguments>
21-
<argument name="itemMap" xsi:type="array">
22-
<item name="bundle" xsi:type="string">Magento\Bundle\CustomerData\BundleItem</item>
23-
</argument>
24-
</arguments>
25-
</type>
2619
</config>

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php

+3
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ protected function _prepareForm()
194194
);
195195

196196
$this->_eventManager->dispatch('product_attribute_form_build', ['form' => $form]);
197+
if ($attributeObject->getId() && !$attributeObject->getIsUserDefined()) {
198+
$form->getElement('is_global')->setDisabled(1);
199+
}
197200
$this->setForm($form);
198201
return $this;
199202
}

app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,15 @@ public function execute()
142142
$category->setData('use_post_data_config', $this->getRequest()->getPost('use_config'));
143143

144144
try {
145+
$categoryResource = $category->getResource();
146+
if ($category->hasCustomDesignTo()) {
147+
$categoryResource->getAttribute('custom_design_from')->setMaxValue($category->getCustomDesignTo());
148+
}
145149
$validate = $category->validate();
146150
if ($validate !== true) {
147151
foreach ($validate as $code => $error) {
148152
if ($error === true) {
149-
$attribute = $category->getResource()->getAttribute($code)->getFrontend()->getLabel();
153+
$attribute = $categoryResource->getAttribute($code)->getFrontend()->getLabel();
150154
throw new \Magento\Framework\Exception\LocalizedException(
151155
__('Attribute "%1" is required.', $attribute)
152156
);

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php renamed to app/code/Magento/Catalog/Model/Attribute/Backend/Startdate.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © 2015 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Catalog\Model\Product\Attribute\Backend;
6+
namespace Magento\Catalog\Model\Attribute\Backend;
77

88
/**
99
*

app/code/Magento/Catalog/Model/ProductRepository.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Magento\Framework\Api\ImageProcessorInterface;
1616
use Magento\Framework\Api\SearchCriteriaInterface;
1717
use Magento\Framework\Api\SortOrder;
18-
use Magento\Framework\App\Filesystem\DirectoryList;
1918
use Magento\Framework\Exception\InputException;
2019
use Magento\Framework\Exception\NoSuchEntityException;
2120
use Magento\Framework\Exception\StateException;
@@ -219,6 +218,9 @@ public function get($sku, $editMode = false, $storeId = null, $forceReload = fal
219218
if ($editMode) {
220219
$product->setData('_edit_mode', true);
221220
}
221+
if ($storeId !== null) {
222+
$product->setData('store_id', $storeId);
223+
}
222224
$product->load($productId);
223225
$this->instances[$sku][$cacheKey] = $product;
224226
$this->instancesById[$product->getId()][$cacheKey] = $product;
@@ -234,7 +236,6 @@ public function getById($productId, $editMode = false, $storeId = null, $forceRe
234236
$cacheKey = $this->getCacheKey(func_get_args());
235237
if (!isset($this->instancesById[$productId][$cacheKey]) || $forceReload) {
236238
$product = $this->productFactory->create();
237-
238239
if ($editMode) {
239240
$product->setData('_edit_mode', true);
240241
}

app/code/Magento/Catalog/Model/Resource/Category/Attribute/Source/Mode.php

-31
This file was deleted.

app/code/Magento/Catalog/Model/Resource/Category/Tree.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,7 @@ protected function _createCollectionDataSelect($sorted = true, $optionalAttribut
590590
$select->joinLeft(
591591
[$tableDefault => $attribute->getBackend()->getTable()],
592592
sprintf(
593-
'%1$s.entity_id=e.entity_id AND %1$s.attribute_id=%2$d' .
594-
' AND %1$s.entity_type_id=e.entity_type_id AND %1$s.store_id=%3$d',
593+
'%1$s.entity_id=e.entity_id AND %1$s.attribute_id=%2$d AND %1$s.store_id=%3$d',
595594
$tableDefault,
596595
$attribute->getId(),
597596
\Magento\Store\Model\Store::DEFAULT_STORE_ID
@@ -600,8 +599,7 @@ protected function _createCollectionDataSelect($sorted = true, $optionalAttribut
600599
)->joinLeft(
601600
[$tableStore => $attribute->getBackend()->getTable()],
602601
sprintf(
603-
'%1$s.entity_id=e.entity_id AND %1$s.attribute_id=%2$d' .
604-
' AND %1$s.entity_type_id=e.entity_type_id AND %1$s.store_id=%3$d',
602+
'%1$s.entity_id=e.entity_id AND %1$s.attribute_id=%2$d AND %1$s.store_id=%3$d',
605603
$tableStore,
606604
$attribute->getId(),
607605
$this->getStoreId()

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function getDefaultEntities()
217217
'type' => 'datetime',
218218
'label' => 'Active From',
219219
'input' => 'date',
220-
'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\Datetime',
220+
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
221221
'required' => false,
222222
'sort_order' => 30,
223223
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE,
@@ -420,7 +420,7 @@ public function getDefaultEntities()
420420
'type' => 'datetime',
421421
'label' => 'Special Price From Date',
422422
'input' => 'date',
423-
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate',
423+
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
424424
'required' => false,
425425
'sort_order' => 4,
426426
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE,
@@ -584,7 +584,7 @@ public function getDefaultEntities()
584584
'type' => 'datetime',
585585
'label' => 'Set Product as New from Date',
586586
'input' => 'date',
587-
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate',
587+
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
588588
'required' => false,
589589
'sort_order' => 7,
590590
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE,
@@ -652,7 +652,7 @@ public function getDefaultEntities()
652652
'type' => 'datetime',
653653
'label' => 'Active From',
654654
'input' => 'date',
655-
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate',
655+
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
656656
'required' => false,
657657
'sort_order' => 2,
658658
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Attribute\Edit\Tab;
7+
8+
class AdvancedTest extends \PHPUnit_Framework_TestCase
9+
{
10+
/**
11+
* @var \Magento\Catalog\Block\Adminhtml\Product\Attribute\Grid
12+
*/
13+
protected $block;
14+
15+
/**
16+
* @var \Magento\Framework\Data\FormFactory|\PHPUnit_Framework_MockObject_MockObject
17+
*/
18+
protected $formFactory;
19+
20+
/**
21+
* @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject
22+
*/
23+
protected $registry;
24+
25+
/**
26+
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject
27+
*/
28+
protected $localeDate;
29+
30+
/**
31+
* @var \Magento\Config\Model\Config\Source\Yesno|\PHPUnit_Framework_MockObject_MockObject
32+
*/
33+
protected $yesNo;
34+
35+
/**
36+
* @var \Magento\Eav\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
37+
*/
38+
protected $eavData;
39+
40+
/**
41+
* @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject
42+
*/
43+
protected $filesystem;
44+
45+
protected function setUp()
46+
{
47+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
48+
$this->registry = $this->getMock('\Magento\Framework\Registry');
49+
$this->formFactory = $this->getMock('Magento\Framework\Data\FormFactory', [], [], '', false);
50+
$this->yesNo = $this->getMock('Magento\Config\Model\Config\Source\Yesno');
51+
$this->localeDate = $this->getMock('Magento\Framework\Stdlib\DateTime\TimezoneInterface');
52+
$this->eavData = $this->getMock('Magento\Eav\Helper\Data', [], [], '', false);
53+
$this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
54+
55+
$this->block = $objectManager->getObject(
56+
'Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Advanced',
57+
[
58+
'registry' => $this->registry,
59+
'formFactory' => $this->formFactory,
60+
'localeDate' => $this->localeDate,
61+
'yesNo' => $this->yesNo,
62+
'eavData' => $this->eavData,
63+
'filesystem' => $this->filesystem
64+
]
65+
);
66+
}
67+
68+
public function testToHtml()
69+
{
70+
$fieldSet = $this->getMock('Magento\Framework\Data\Form\Element\Fieldset', [], [], '', false);
71+
$form = $this->getMock('Magento\Framework\Data\Form', [], [], '', false);
72+
$attributeModel = $this->getMock('\Magento\Catalog\Model\Resource\Eav\Attribute', [], [], '', false);
73+
$entityType = $this->getMock('Magento\Eav\Model\Entity\Type', [], [], '', false);
74+
$formElement = $this->getMock('Magento\Framework\Data\Form\Element\Text', ['setDisabled'], [], '', false);
75+
$directoryReadInterface = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface');
76+
77+
$this->registry->expects($this->any())->method('registry')->with('entity_attribute')
78+
->willReturn($attributeModel);
79+
$this->formFactory->expects($this->any())->method('create')->willReturn($form);
80+
$form->expects($this->any())->method('addFieldset')->willReturn($fieldSet);
81+
$form->expects($this->any())->method('getElement')->willReturn($formElement);
82+
$fieldSet->expects($this->any())->method('addField')->willReturnSelf();
83+
$attributeModel->expects($this->any())->method('getDefaultValue')->willReturn('default_value');
84+
$attributeModel->expects($this->any())->method('setDisabled')->willReturnSelf();
85+
$attributeModel->expects($this->any())->method('getId')->willReturn(1);
86+
$attributeModel->expects($this->any())->method('getEntityType')->willReturn($entityType);
87+
$attributeModel->expects($this->any())->method('getIsUserDefined')->willReturn(false);
88+
$attributeModel->expects($this->any())->method('getAttributeCode')->willReturn('attribute_code');
89+
$this->localeDate->expects($this->any())->method('getDateFormat')->willReturn('mm/dd/yy');
90+
$entityType->expects($this->any())->method('getEntityTypeCode')->willReturn('entity_type_code');
91+
$this->eavData->expects($this->any())->method('getFrontendClasses')->willReturn([]);
92+
$formElement->expects($this->exactly(3))->method('setDisabled')->willReturnSelf();
93+
$this->yesNo->expects($this->any())->method('toOptionArray')->willReturn(['yes', 'no']);
94+
$this->filesystem->expects($this->any())->method('getDirectoryRead')->willReturn($directoryReadInterface);
95+
$directoryReadInterface->expects($this->any())->method('getRelativePath')->willReturn('relative_path');
96+
97+
$this->block->setData(['action' => 'save']);
98+
$this->block->toHtml();
99+
}
100+
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/SaveTest.php

+12
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ public function testExecute($categoryId, $storeId, $activeTabId, $parentId)
239239
'setStoreId',
240240
'load',
241241
'getPath',
242+
'getResource',
242243
'setPath',
243244
'setParentId',
244245
'setData',
@@ -491,6 +492,17 @@ public function testExecute($categoryId, $storeId, $activeTabId, $parentId)
491492
'catalog_category_prepare_save',
492493
['category' => $categoryMock, 'request' => $this->requestMock]
493494
);
495+
496+
$categoryResource = $this->getMock(
497+
'Magento\Catalog\Model\Resource\Category',
498+
[],
499+
[],
500+
'',
501+
false
502+
);
503+
$categoryMock->expects($this->once())
504+
->method('getResource')
505+
->will($this->returnValue($categoryResource));
494506
$categoryMock->expects($this->once())
495507
->method('validate')
496508
->will($this->returnValue(true));

0 commit comments

Comments
 (0)