Skip to content

Commit

Permalink
Merge pull request #319 from magento-goinc/MAGETWO-37718
Browse files Browse the repository at this point in the history
[MX][Virtual Team, GoInc] Public GitHub Issues, Bug Fixes
  • Loading branch information
orlangur committed May 22, 2015
2 parents 4f8cc5c + 473655c commit aaa8291
Show file tree
Hide file tree
Showing 30 changed files with 938 additions and 637 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Refactored controller actions in the Product area
* 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
* Data Migration Tool
* The Data Migraiton Tool is published in the separate [repository](https://github.com/magento/data-migration-tool-ce, "Data Migration Tool repository")
* The Data Migraiton Tool is published in the separate [repository](https://github.com/magento/data-migration-tool-ce "Data Migration Tool repository")
* Fixed bugs
* Fixed an issue where error appeared during placing order with virtual product
* Fixed an issue where billing and shipping sections didn't contain address information on order print
Expand Down
47 changes: 0 additions & 47 deletions app/code/Magento/Bundle/CustomerData/BundleItem.php

This file was deleted.

1 change: 0 additions & 1 deletion app/code/Magento/Bundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"magento/framework": "0.74.0-beta9",
"magento/module-quote": "0.74.0-beta9",
"magento/module-media-storage": "0.74.0-beta9",
"magento/module-msrp": "0.74.0-beta9",
"magento/magento-composer-installer": "*"
},
"suggest": {
Expand Down
7 changes: 0 additions & 7 deletions app/code/Magento/Bundle/etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,4 @@
</argument>
</arguments>
</type>
<type name="Magento\Checkout\CustomerData\ItemPoolInterface">
<arguments>
<argument name="itemMap" xsi:type="array">
<item name="bundle" xsi:type="string">Magento\Bundle\CustomerData\BundleItem</item>
</argument>
</arguments>
</type>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ protected function _prepareForm()
);

$this->_eventManager->dispatch('product_attribute_form_build', ['form' => $form]);
if ($attributeObject->getId() && !$attributeObject->getIsUserDefined()) {
$form->getElement('is_global')->setDisabled(1);
}
$this->setForm($form);
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ public function execute()
$category->setData('use_post_data_config', $this->getRequest()->getPost('use_config'));

try {
$categoryResource = $category->getResource();
if ($category->hasCustomDesignTo()) {
$categoryResource->getAttribute('custom_design_from')->setMaxValue($category->getCustomDesignTo());
}
$validate = $category->validate();
if ($validate !== true) {
foreach ($validate as $code => $error) {
if ($error === true) {
$attribute = $category->getResource()->getAttribute($code)->getFrontend()->getLabel();
$attribute = $categoryResource->getAttribute($code)->getFrontend()->getLabel();
throw new \Magento\Framework\Exception\LocalizedException(
__('Attribute "%1" is required.', $attribute)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model\Product\Attribute\Backend;
namespace Magento\Catalog\Model\Attribute\Backend;

/**
*
Expand Down
5 changes: 3 additions & 2 deletions app/code/Magento/Catalog/Model/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Magento\Framework\Api\ImageProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\SortOrder;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\StateException;
Expand Down Expand Up @@ -219,6 +218,9 @@ public function get($sku, $editMode = false, $storeId = null, $forceReload = fal
if ($editMode) {
$product->setData('_edit_mode', true);
}
if ($storeId !== null) {
$product->setData('store_id', $storeId);
}
$product->load($productId);
$this->instances[$sku][$cacheKey] = $product;
$this->instancesById[$product->getId()][$cacheKey] = $product;
Expand All @@ -234,7 +236,6 @@ public function getById($productId, $editMode = false, $storeId = null, $forceRe
$cacheKey = $this->getCacheKey(func_get_args());
if (!isset($this->instancesById[$productId][$cacheKey]) || $forceReload) {
$product = $this->productFactory->create();

if ($editMode) {
$product->setData('_edit_mode', true);
}
Expand Down

This file was deleted.

6 changes: 2 additions & 4 deletions app/code/Magento/Catalog/Model/Resource/Category/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,7 @@ protected function _createCollectionDataSelect($sorted = true, $optionalAttribut
$select->joinLeft(
[$tableDefault => $attribute->getBackend()->getTable()],
sprintf(
'%1$s.entity_id=e.entity_id AND %1$s.attribute_id=%2$d' .
' AND %1$s.entity_type_id=e.entity_type_id AND %1$s.store_id=%3$d',
'%1$s.entity_id=e.entity_id AND %1$s.attribute_id=%2$d AND %1$s.store_id=%3$d',
$tableDefault,
$attribute->getId(),
\Magento\Store\Model\Store::DEFAULT_STORE_ID
Expand All @@ -600,8 +599,7 @@ protected function _createCollectionDataSelect($sorted = true, $optionalAttribut
)->joinLeft(
[$tableStore => $attribute->getBackend()->getTable()],
sprintf(
'%1$s.entity_id=e.entity_id AND %1$s.attribute_id=%2$d' .
' AND %1$s.entity_type_id=e.entity_type_id AND %1$s.store_id=%3$d',
'%1$s.entity_id=e.entity_id AND %1$s.attribute_id=%2$d AND %1$s.store_id=%3$d',
$tableStore,
$attribute->getId(),
$this->getStoreId()
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Catalog/Setup/CategorySetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function getDefaultEntities()
'type' => 'datetime',
'label' => 'Active From',
'input' => 'date',
'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\Datetime',
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
'required' => false,
'sort_order' => 30,
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE,
Expand Down Expand Up @@ -420,7 +420,7 @@ public function getDefaultEntities()
'type' => 'datetime',
'label' => 'Special Price From Date',
'input' => 'date',
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate',
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
'required' => false,
'sort_order' => 4,
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE,
Expand Down Expand Up @@ -584,7 +584,7 @@ public function getDefaultEntities()
'type' => 'datetime',
'label' => 'Set Product as New from Date',
'input' => 'date',
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate',
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
'required' => false,
'sort_order' => 7,
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE,
Expand Down Expand Up @@ -652,7 +652,7 @@ public function getDefaultEntities()
'type' => 'datetime',
'label' => 'Active From',
'input' => 'date',
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate',
'backend' => 'Magento\Catalog\Model\Attribute\Backend\Startdate',
'required' => false,
'sort_order' => 2,
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Attribute\Edit\Tab;

class AdvancedTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Magento\Catalog\Block\Adminhtml\Product\Attribute\Grid
*/
protected $block;

/**
* @var \Magento\Framework\Data\FormFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $formFactory;

/**
* @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject
*/
protected $registry;

/**
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $localeDate;

/**
* @var \Magento\Config\Model\Config\Source\Yesno|\PHPUnit_Framework_MockObject_MockObject
*/
protected $yesNo;

/**
* @var \Magento\Eav\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
*/
protected $eavData;

/**
* @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject
*/
protected $filesystem;

protected function setUp()
{
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->registry = $this->getMock('\Magento\Framework\Registry');
$this->formFactory = $this->getMock('Magento\Framework\Data\FormFactory', [], [], '', false);
$this->yesNo = $this->getMock('Magento\Config\Model\Config\Source\Yesno');
$this->localeDate = $this->getMock('Magento\Framework\Stdlib\DateTime\TimezoneInterface');
$this->eavData = $this->getMock('Magento\Eav\Helper\Data', [], [], '', false);
$this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);

$this->block = $objectManager->getObject(
'Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Advanced',
[
'registry' => $this->registry,
'formFactory' => $this->formFactory,
'localeDate' => $this->localeDate,
'yesNo' => $this->yesNo,
'eavData' => $this->eavData,
'filesystem' => $this->filesystem
]
);
}

public function testToHtml()
{
$fieldSet = $this->getMock('Magento\Framework\Data\Form\Element\Fieldset', [], [], '', false);
$form = $this->getMock('Magento\Framework\Data\Form', [], [], '', false);
$attributeModel = $this->getMock('\Magento\Catalog\Model\Resource\Eav\Attribute', [], [], '', false);
$entityType = $this->getMock('Magento\Eav\Model\Entity\Type', [], [], '', false);
$formElement = $this->getMock('Magento\Framework\Data\Form\Element\Text', ['setDisabled'], [], '', false);
$directoryReadInterface = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface');

$this->registry->expects($this->any())->method('registry')->with('entity_attribute')
->willReturn($attributeModel);
$this->formFactory->expects($this->any())->method('create')->willReturn($form);
$form->expects($this->any())->method('addFieldset')->willReturn($fieldSet);
$form->expects($this->any())->method('getElement')->willReturn($formElement);
$fieldSet->expects($this->any())->method('addField')->willReturnSelf();
$attributeModel->expects($this->any())->method('getDefaultValue')->willReturn('default_value');
$attributeModel->expects($this->any())->method('setDisabled')->willReturnSelf();
$attributeModel->expects($this->any())->method('getId')->willReturn(1);
$attributeModel->expects($this->any())->method('getEntityType')->willReturn($entityType);
$attributeModel->expects($this->any())->method('getIsUserDefined')->willReturn(false);
$attributeModel->expects($this->any())->method('getAttributeCode')->willReturn('attribute_code');
$this->localeDate->expects($this->any())->method('getDateFormat')->willReturn('mm/dd/yy');
$entityType->expects($this->any())->method('getEntityTypeCode')->willReturn('entity_type_code');
$this->eavData->expects($this->any())->method('getFrontendClasses')->willReturn([]);
$formElement->expects($this->exactly(3))->method('setDisabled')->willReturnSelf();
$this->yesNo->expects($this->any())->method('toOptionArray')->willReturn(['yes', 'no']);
$this->filesystem->expects($this->any())->method('getDirectoryRead')->willReturn($directoryReadInterface);
$directoryReadInterface->expects($this->any())->method('getRelativePath')->willReturn('relative_path');

$this->block->setData(['action' => 'save']);
$this->block->toHtml();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public function testExecute($categoryId, $storeId, $activeTabId, $parentId)
'setStoreId',
'load',
'getPath',
'getResource',
'setPath',
'setParentId',
'setData',
Expand Down Expand Up @@ -491,6 +492,17 @@ public function testExecute($categoryId, $storeId, $activeTabId, $parentId)
'catalog_category_prepare_save',
['category' => $categoryMock, 'request' => $this->requestMock]
);

$categoryResource = $this->getMock(
'Magento\Catalog\Model\Resource\Category',
[],
[],
'',
false
);
$categoryMock->expects($this->once())
->method('getResource')
->will($this->returnValue($categoryResource));
$categoryMock->expects($this->once())
->method('validate')
->will($this->returnValue(true));
Expand Down
Loading

0 comments on commit aaa8291

Please sign in to comment.