Skip to content

Commit 1ea57c2

Browse files
authored
Merge pull request #97 from magento-nord/MAGETWO-53170
[NORD] Bug fixes
2 parents 6a38dd7 + 015a299 commit 1ea57c2

File tree

5 files changed

+116
-1
lines changed

5 files changed

+116
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
9+
<event name="catalog_product_to_website_change">
10+
<observer name="catalog_product_to_website_change" instance="Magento\CatalogUrlRewrite\Observer\ProductToWebsiteChangeObserver"/>
11+
</event>
12+
</config>

app/code/Magento/Checkout/CustomerData/DefaultItem.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ protected function doGetItemData()
7171
'configure_url' => $this->getConfigureUrl(),
7272
'is_visible_in_site_visibility' => $this->item->getProduct()->isVisibleInSiteVisibility(),
7373
'product_name' => $this->item->getProduct()->getName(),
74+
'product_sku' => $this->item->getProduct()->getSku(),
7475
'product_url' => $this->getProductUrl(),
7576
'product_has_url' => $this->hasProductUrl(),
7677
'product_price' => $this->checkoutHelper->formatPrice($this->item->getCalculationPrice()),
78+
'product_price_value' => $this->item->getCalculationPrice(),
7779
'product_image' => [
7880
'src' => $imageHelper->getUrl(),
7981
'alt' => $imageHelper->getLabel(),
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Checkout\Test\Unit\CustomerData;
7+
8+
class DefaultItemTest extends \PHPUnit_Framework_TestCase
9+
{
10+
/**
11+
* @var \Magento\Checkout\CustomerData\DefaultItem
12+
*/
13+
protected $model;
14+
15+
/**
16+
* @var \Magento\Catalog\Helper\Image
17+
*/
18+
private $imageHelper;
19+
20+
/**
21+
* @var \Magento\Catalog\Helper\Product\ConfigurationPool
22+
*/
23+
private $configurationPool;
24+
25+
protected function setUp()
26+
{
27+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
28+
$this->imageHelper = $this->getMockBuilder(\Magento\Catalog\Helper\Image::class)
29+
->disableOriginalConstructor()
30+
->getMock();
31+
$this->configurationPool = $this->getMockBuilder(\Magento\Catalog\Helper\Product\ConfigurationPool::class)
32+
->setMethods([])
33+
->disableOriginalConstructor()
34+
->getMock();
35+
$checkoutHelper = $this->getMockBuilder(\Magento\Checkout\Helper\Data::class)
36+
->setMethods(['formatPrice'])->disableOriginalConstructor()->getMock();
37+
$checkoutHelper->expects($this->any())->method('formatPrice')->willReturn(5);
38+
$this->model = $objectManager->getObject(
39+
\Magento\Checkout\CustomerData\DefaultItem::class,
40+
[
41+
'imageHelper' => $this->imageHelper,
42+
'configurationPool' => $this->configurationPool,
43+
'checkoutHelper' => $checkoutHelper
44+
]
45+
);
46+
}
47+
48+
public function testGetItemData()
49+
{
50+
$urlModel = $this->getMockBuilder(\Magento\Catalog\Model\Product\Url::class)
51+
->disableOriginalConstructor()
52+
->getMock();
53+
$product = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
54+
->setMethods(['getUrlModel', 'isVisibleInSiteVisibility', 'getSku'])
55+
->disableOriginalConstructor()
56+
->getMock();
57+
$product->expects($this->any())->method('getUrlModel')->willReturn($urlModel);
58+
$product->expects($this->any())->method('isVisibleInSiteVisibility')->willReturn(true);
59+
$product->expects($this->any())->method('getSku')->willReturn('simple');
60+
/** @var \Magento\Quote\Model\Quote\Item $item */
61+
$item = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item::class)
62+
->setMethods(['getProductType', 'getProduct', 'getCalculationPrice'])
63+
->disableOriginalConstructor()
64+
->getMock();
65+
$item->expects($this->any())->method('getProduct')->willReturn($product);
66+
$item->expects($this->any())->method('getProductType')->willReturn('simple');
67+
$item->expects($this->any())->method('getCalculationPrice')->willReturn(5);
68+
69+
$this->imageHelper->expects($this->any())->method('init')->with($product)->willReturnSelf();
70+
$this->imageHelper->expects($this->any())->method('getUrl')->willReturn('url');
71+
$this->imageHelper->expects($this->any())->method('getLabel')->willReturn('label');
72+
$this->imageHelper->expects($this->any())->method('getWidth')->willReturn(100);
73+
$this->imageHelper->expects($this->any())->method('getHeight')->willReturn(100);
74+
$this->configurationPool->expects($this->any())->method('getByProductType')->willReturn($product);
75+
76+
$itemData = $this->model->getItemData($item);
77+
$this->assertArrayHasKey('options', $itemData);
78+
$this->assertArrayHasKey('qty', $itemData);
79+
$this->assertArrayHasKey('item_id', $itemData);
80+
$this->assertArrayHasKey('configure_url', $itemData);
81+
$this->assertArrayHasKey('is_visible_in_site_visibility', $itemData);
82+
$this->assertArrayHasKey('product_type', $itemData);
83+
$this->assertArrayHasKey('product_name', $itemData);
84+
$this->assertArrayHasKey('product_sku', $itemData);
85+
$this->assertArrayHasKey('product_url', $itemData);
86+
$this->assertArrayHasKey('product_has_url', $itemData);
87+
$this->assertArrayHasKey('product_price', $itemData);
88+
$this->assertArrayHasKey('product_price_value', $itemData);
89+
$this->assertArrayHasKey('product_image', $itemData);
90+
$this->assertArrayHasKey('canApplyMsrp', $itemData);
91+
}
92+
}
93+

app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
<input data-bind="attr: {
7575
id: 'cart-item-'+item_id+'-qty',
7676
'data-cart-item': item_id,
77-
'data-item-qty': qty
77+
'data-item-qty': qty,
78+
'data-cart-item-id': product_sku
7879
}, value: qty"
7980
type="number"
8081
size="4"

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ class View extends AbstractConfigureBlock
189189
*/
190190
protected $baseImage = '[data-gallery-role="gallery"] img.fotorama__img.fotorama__img';
191191

192+
/**
193+
* @var string
194+
*/
195+
protected $galleryLoader = '.fotorama__spinner--show';
196+
192197
/**
193198
* Video Container selector
194199
*
@@ -499,6 +504,7 @@ public function waitLoader()
499504
*/
500505
public function isGalleryVisible()
501506
{
507+
$this->waitForElementNotVisible($this->galleryLoader);
502508
return $this->_rootElement->find($this->mediaGallery)->isVisible();
503509
}
504510

@@ -509,6 +515,7 @@ public function isGalleryVisible()
509515
*/
510516
public function isFullImageVisible()
511517
{
518+
$this->waitForElementNotVisible($this->galleryLoader);
512519
return $this->browser->find($this->fullImage)->isVisible();
513520
}
514521

0 commit comments

Comments
 (0)