Skip to content

Commit

Permalink
Merge pull request #561 from magento-troll/troll-bugs
Browse files Browse the repository at this point in the history
Troll bugs
  • Loading branch information
Onischenko, Yaroslav(yonischenko) committed Apr 26, 2016
2 parents 8bc4691 + 9f31c44 commit 91c7893
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ protected function _prepareCollection()
'sku'
)->addAttributeToSelect(
'price'
)->addStoreFilter(
$this->getRequest()->getParam('store')
)->joinField(
'position',
'catalog_category_product',
Expand All @@ -114,6 +112,10 @@ protected function _prepareCollection()
'category_id=' . (int)$this->getRequest()->getParam('id', 0),
'left'
);
$storeId = (int)$this->getRequest()->getParam('store', 0);
if ($storeId > 0) {
$collection->addStoreFilter($storeId);
}
$this->setCollection($collection);

if ($this->getCategory()->getProductsReadonly()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public function execute()
throw new \Exception(__('Category is not available for requested store.'));
}
$category->move($parentNodeId, $prevNodeId);
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$error = true;
$this->messageManager->addError(__('There was a category move error.'));
} catch (\Magento\Framework\Exception\AlreadyExistsException $e) {
$error = true;
$this->messageManager->addError(__('There was a category move error. %1', $e->getMessage()));
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$error = true;
$this->messageManager->addError($e->getMessage());
} catch (\Exception $e) {
$error = true;
$this->messageManager->addError(__('There was a category move error.'));
Expand Down
6 changes: 1 addition & 5 deletions app/code/Magento/Catalog/Model/ResourceModel/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,17 +522,14 @@ public function duplicate($oldId, $newId)
)->where(
$this->getLinkField() . ' = ?',
$oldId
)->where(
'store_id >= ?',
0
);

$connection->query(
$connection->insertFromSelect(
$select,
$tableName,
['attribute_id', 'store_id', $this->getLinkField(), 'value'],
\Magento\Framework\DB\Adapter\AdapterInterface::INSERT_ON_DUPLICATE
\Magento\Framework\DB\Adapter\AdapterInterface::INSERT_IGNORE
)
);
}
Expand All @@ -541,7 +538,6 @@ public function duplicate($oldId, $newId)
$statusAttribute = $this->getAttribute('status');
$statusAttributeId = $statusAttribute->getAttributeId();
$statusAttributeTable = $statusAttribute->getBackend()->getTable();
$updateCond[] = 'store_id >= 0';
$updateCond[] = $connection->quoteInto($this->getLinkField() . ' = ?', $newId);
$updateCond[] = $connection->quoteInto('attribute_id = ?', $statusAttributeId);
$connection->update(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function testCreateWithCannotSaveException()
$productSku = 'mediaProduct';
$entryContentMock = $this->getMockBuilder('\Magento\Framework\Api\Data\ImageContentInterface')
->disableOriginalConstructor()
->getMock();;
->getMock();
$this->mediaGalleryEntryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock);
$this->productRepositoryMock->expects($this->once())
->method('get')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@
} else {
$(obj.tree.container.dom).trigger('categoryMove.tree');
}
$('.page-main-actions').next('.messages').remove();
$('.page-main-actions').next('#messages').remove();
$('.page-main-actions').after(data.messages);
}).fail(function (jqXHR, textStatus) {
if (window.console) {
console.log(textStatus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
?>

<meta property="og:type" content="og:product" />
<meta property="og:title" content="<?php /* @escapeNotVerified */ echo $block->stripTags($block->getProduct()->getName()); ?>" />
<meta property="og:image" content="<?php /* @escapeNotVerified */ echo $block->stripTags($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()); ?>" />
<meta property="og:description" content="<?php /* @escapeNotVerified */ echo $block->stripTags($block->getProduct()->getShortDescription()); ?>" />
<meta property="og:url" content="<?php /* @escapeNotVerified */ echo $block->stripTags($block->getProduct()->getProductUrl()); ?>" />
<meta property="og:title" content="<?php echo $block->escapeHtml($block->getProduct()->getName()); ?>" />
<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()); ?>" />
<meta property="og:description" content="<?php echo $block->escapeHtml($block->getProduct()->getShortDescription()); ?>" />
<meta property="og:url" content="<?php echo $block->escapeUrl($block->getProduct()->getProductUrl()); ?>" />
<?php if ($priceAmount = $block->getProduct()->getFinalPrice()):?>
<meta property="product:price:amount" content="<?php /* @escapeNotVerified */ echo $priceAmount; ?>"/>
<?php echo $block->getChildHtml('meta.currency'); ?>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ public function testBeforeSaveIsVirtualQuote(array $productTypes, $expected)
);
$items = [];
foreach ($productTypes as $type) {
$productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);;
$productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
$productMock->expects($this->any())->method('getIsVirtual')->willReturn($type);

$itemMock = $this->getMock(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function resolveCustomerNames()

$select->from(
['customer' => $this->customerResource->getTable('customer_entity')],
['email']
['entity_id', 'email']
);
$select->columns(
['customer_name' => $customerName]
Expand All @@ -171,8 +171,11 @@ public function resolveCustomerNames()
$customersData = $this->customerResource->getConnection()->fetchAll($select);

foreach ($this->getItems() as $item) {
$item->setData(array_merge($item->getData(), current($customersData)));
next($customersData);
foreach ($customersData as $customerItemData) {
if ($item['customer_id'] == $customerItemData['entity_id']) {
$item->setData(array_merge($item->getData(), $customerItemData));
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,14 @@ public function testResolveCustomerNames()
$customerName = "CONCAT_WS('firstname', 'lastname')";
$customerTableName = 'customer_entity';
$customerId = ['customer_id' => ['test_id']];
$customersData = [['item_1']];
$itemData = ['test'];
$customersData = [['entity_id' => 'test_id', 'name' => 'item_1']];

$this->selectMock->expects($this->any())
->method('getConnection')
->willReturn($this->connectionMock);
$this->selectMock->expects($this->once())
->method('from')
->with(['customer' => $customerTableName], ['email'])
->with(['customer' => $customerTableName], ['entity_id', 'email'])
->willReturnSelf();
$this->selectMock->expects($this->once())
->method('columns')
Expand Down Expand Up @@ -158,9 +157,6 @@ public function testResolveCustomerNames()
$itemMock = $this->getMockBuilder('Magento\Framework\Model\AbstractModel')
->disableOriginalConstructor()
->getMock();
$itemMock->expects($this->once())
->method('getData')
->willReturn($itemData);

$this->entityFactoryMock->expects($this->any())
->method('create')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
<block class="Magento\Backend\Block\Store\Switcher" name="adminhtml.report.grid.store_switcher" as="store_switcher">
<arguments>
<argument name="use_confirm" xsi:type="string">0</argument>
<argument name="switch_url" xsi:type="url" path="*/*/*">
<param name="store">null</param>
</argument>
<argument name="switch_websites" xsi:type="string">1</argument>
<argument name="switch_store_groups" xsi:type="string">1</argument>
<argument name="switch_store_views" xsi:type="string">1</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,9 @@ public function setValue($value)
if ($value == '') {
return;
}
foreach (str_split($value) as $symbol) {
$this->keys([$symbol]);
$searchedItem = $this->find(sprintf($this->resultItem, $value), Locator::SELECTOR_XPATH);
if ($searchedItem->isVisible()) {
try {
$searchedItem->click();
break;
} catch (\Exception $e) {
// In parallel run on windows change the focus is lost on element
// that causes disappearing of category suggest list.
}
}
}
$this->keys([$value]);
$searchedItem = $this->find(sprintf($this->resultItem, $value), Locator::SELECTOR_XPATH);
$searchedItem->click();
$closeButton = $this->find($this->closeButton);
if ($closeButton->isVisible()) {
$closeButton->click();
Expand All @@ -102,7 +92,9 @@ public function setValue($value)
*/
public function keys(array $keys)
{
$this->find($this->advancedSelect)->click();
if (!$this->find($this->selectInput)->isVisible()) {
$this->find($this->advancedSelect)->click();
}
$input = $this->find($this->selectInput);
$input->click();
$input->keys($keys);
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/View/Page/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function getTitle()
public function setMetadata($name, $content)
{
$this->build();
$this->metadata[$name] = $content;
$this->metadata[$name] = htmlentities($content);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ public function testMetadata()
'keywords' => null,
'robots' => null,
'name' => 'test_value',
'html_encoded' => '&lt;title&gt;&lt;span class=&quot;test&quot;&gt;Test&lt;/span&gt;&lt;/title&gt;',
];
$this->model->setMetadata('name', 'test_value');
$this->model->setMetadata('html_encoded', '<title><span class="test">Test</span></title>');
$this->assertEquals($expectedMetadata, $this->model->getMetadata());
}

Expand Down

0 comments on commit 91c7893

Please sign in to comment.