Skip to content

Commit 8677d51

Browse files
committed
MAGETWO-69234: Backport of MAGETWO-69152: Removed workaround for old Webkit bug in t… #9655
- Merge Pull Request #9655 from hostep/magento2:backport-magetwo-69152
2 parents 8a84178 + 27675cd commit 8677d51

File tree

21 files changed

+170
-51
lines changed

21 files changed

+170
-51
lines changed

app/code/Magento/Config/Model/Config/Backend/Email/Logo.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
namespace Magento\Config\Model\Config\Backend\Email;
1313

14+
/**
15+
* @deprecated
16+
*/
1417
class Logo extends \Magento\Config\Model\Config\Backend\Image
1518
{
1619
/**

app/code/Magento/Email/Model/AbstractTemplate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ protected function getLogoUrl($store)
389389
$store
390390
);
391391
if ($fileName) {
392-
$uploadDir = \Magento\Config\Model\Config\Backend\Email\Logo::UPLOAD_DIR;
392+
$uploadDir = \Magento\Email\Model\Design\Backend\Logo::UPLOAD_DIR;
393393
$mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);
394394
if ($mediaDirectory->isFile($uploadDir . '/' . $fileName)) {
395395
return $this->storeManager->getStore()->getBaseUrl(
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Email\Model\Design\Backend;
7+
8+
use Magento\Theme\Model\Design\Backend\Logo as DesignLogo;
9+
10+
class Logo extends DesignLogo
11+
{
12+
/**
13+
* The tail part of directory path for uploading
14+
*/
15+
const UPLOAD_DIR = 'email/logo';
16+
17+
/**
18+
* Upload max file size in kilobytes
19+
*
20+
* @var int
21+
*/
22+
protected $maxFileSize = 2048;
23+
24+
/**
25+
* Getter for allowed extensions of uploaded files
26+
*
27+
* @return string[]
28+
*/
29+
public function getAllowedExtensions()
30+
{
31+
return ['jpg', 'jpeg', 'gif', 'png'];
32+
}
33+
}

app/code/Magento/Email/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "N/A",
44
"require": {
55
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
6+
"magento/module-theme": "100.1.*",
67
"magento/module-config": "100.1.*",
78
"magento/module-store": "100.1.*",
89
"magento/module-cms": "101.0.*",

app/code/Magento/Email/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<item name="email_logo" xsi:type="array">
2828
<item name="path" xsi:type="string">design/email/logo</item>
2929
<item name="fieldset" xsi:type="string">other_settings/email</item>
30-
<item name="backend_model" xsi:type="string">Magento\Theme\Model\Design\Backend\Logo</item>
30+
<item name="backend_model" xsi:type="string">Magento\Email\Model\Design\Backend\Logo</item>
3131
<item name="base_url" xsi:type="array">
3232
<item name="type" xsi:type="string">media</item>
3333
<item name="scope_info" xsi:type="string">1</item>

app/code/Magento/Theme/Model/Design/Backend/Logo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Logo extends Image
2121
*/
2222
protected function _getUploadDir()
2323
{
24-
return $this->_mediaDirectory->getRelativePath($this->_appendScopeInfo(self::UPLOAD_DIR));
24+
return $this->_mediaDirectory->getRelativePath($this->_appendScopeInfo(static::UPLOAD_DIR));
2525
}
2626

2727
/**

app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,12 @@ class ConfigurableProduct extends FinalPrice implements ConfiguredPriceInterface
2121
*/
2222
public function getValue()
2323
{
24-
$result = 0.;
2524
/** @var \Magento\Wishlist\Model\Item\Option $customOption */
2625
$customOption = $this->getProduct()->getCustomOption('simple_product');
27-
if ($customOption) {
28-
/** @var \Magento\Framework\Pricing\PriceInfoInterface $priceInfo */
29-
$priceInfo = $customOption->getProduct()->getPriceInfo();
30-
$result = $priceInfo->getPrice(self::PRICE_CODE)->getValue();
31-
}
32-
return max(0, $result);
26+
$product = $customOption ? $customOption->getProduct() : $this->getProduct();
27+
$price = $product->getPriceInfo()->getPrice(self::PRICE_CODE)->getValue();
28+
29+
return max(0, $price);
3330
}
3431

3532
/**

app/code/Magento/Wishlist/Test/Unit/Pricing/ConfiguredPrice/ConfigurableProductTest.php

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,30 @@
55
*/
66
namespace Magento\Wishlist\Test\Unit\Pricing\ConfiguredPrice;
77

8-
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
9-
use Magento\Framework\Pricing\PriceCurrencyInterface;
10-
use Magento\Framework\Pricing\PriceInfoInterface;
11-
use Magento\Framework\Pricing\SaleableInterface;
12-
use Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct;
13-
148
class ConfigurableProductTest extends \PHPUnit_Framework_TestCase
159
{
1610
/**
17-
* @var SaleableInterface|\PHPUnit_Framework_MockObject_MockObject
11+
* @var \Magento\Framework\Pricing\SaleableInterface|\PHPUnit_Framework_MockObject_MockObject
1812
*/
1913
private $saleableItem;
2014

2115
/**
22-
* @var CalculatorInterface|\PHPUnit_Framework_MockObject_MockObject
16+
* @var \Magento\Framework\Pricing\Adjustment\CalculatorInterface|\PHPUnit_Framework_MockObject_MockObject
2317
*/
2418
private $calculator;
2519

2620
/**
27-
* @var PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
21+
* @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
2822
*/
2923
private $priceCurrency;
3024

3125
/**
32-
* @var ConfigurableProduct
26+
* @var \Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct
3327
*/
3428
private $model;
3529

3630
/**
37-
* @var PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject
31+
* @var \Magento\Framework\Pricing\PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject
3832
*/
3933
private $priceInfoMock;
4034

@@ -49,17 +43,14 @@ protected function setUp()
4943
'getCustomOption',
5044
])
5145
->getMockForAbstractClass();
52-
$this->saleableItem->expects($this->once())
53-
->method('getPriceInfo')
54-
->willReturn($this->priceInfoMock);
5546

5647
$this->calculator = $this->getMockBuilder('Magento\Framework\Pricing\Adjustment\CalculatorInterface')
5748
->getMockForAbstractClass();
5849

5950
$this->priceCurrency = $this->getMockBuilder('Magento\Framework\Pricing\PriceCurrencyInterface')
6051
->getMockForAbstractClass();
6152

62-
$this->model = new ConfigurableProduct(
53+
$this->model = new \Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct(
6354
$this->saleableItem,
6455
null,
6556
$this->calculator,
@@ -82,7 +73,7 @@ public function testGetValue()
8273
->getMock();
8374
$this->priceInfoMock->expects($this->once())
8475
->method('getPrice')
85-
->with(ConfigurableProduct::PRICE_CODE)
76+
->with(\Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct::PRICE_CODE)
8677
->willReturn($priceMock);
8778

8879
$productMock = $this->getMockBuilder('Magento\Catalog\Model\Product')
@@ -109,11 +100,28 @@ public function testGetValue()
109100

110101
public function testGetValueWithNoCustomOption()
111102
{
103+
$priceValue = 100;
104+
105+
$priceMock = $this->getMockBuilder(\Magento\Framework\Pricing\Price\PriceInterface::class)
106+
->getMockForAbstractClass();
107+
$priceMock->expects($this->once())
108+
->method('getValue')
109+
->willReturn($priceValue);
110+
112111
$this->saleableItem->expects($this->once())
113112
->method('getCustomOption')
114113
->with('simple_product')
115114
->willReturn(null);
116115

117-
$this->assertEquals(0, $this->model->getValue());
116+
$this->saleableItem->expects($this->once())
117+
->method('getPriceInfo')
118+
->willReturn($this->priceInfoMock);
119+
120+
$this->priceInfoMock->expects($this->once())
121+
->method('getPrice')
122+
->with(\Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct::PRICE_CODE)
123+
->willReturn($priceMock);
124+
125+
$this->assertEquals(100, $this->model->getValue());
118126
}
119127
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Wishlist\Test\Constraint;
8+
9+
class AssertProductPriceIsNotZero extends \Magento\Mtf\Constraint\AbstractConstraint
10+
{
11+
/**
12+
* Assert that product price is not zero in default wishlist.
13+
*
14+
* @param \Magento\Cms\Test\Page\CmsIndex $cmsIndex
15+
* @param \Magento\Customer\Test\Page\CustomerAccountIndex $customerAccountIndex
16+
* @param \Magento\Wishlist\Test\Page\WishlistIndex $wishlistIndex
17+
* @param \Magento\Mtf\Fixture\InjectableFixture $product
18+
*
19+
* @return void
20+
*/
21+
public function processAssert(
22+
\Magento\Cms\Test\Page\CmsIndex $cmsIndex,
23+
\Magento\Customer\Test\Page\CustomerAccountIndex $customerAccountIndex,
24+
\Magento\Wishlist\Test\Page\WishlistIndex $wishlistIndex,
25+
\Magento\Mtf\Fixture\InjectableFixture $product
26+
) {
27+
$cmsIndex->getLinksBlock()->openLink('My Account');
28+
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List');
29+
$wishlistItem = $wishlistIndex->getWishlistBlock()->getProductItemsBlock()->getItemProduct($product);
30+
31+
\PHPUnit_Framework_Assert::assertNotEquals(
32+
'0.00',
33+
$wishlistItem->getPrice(),
34+
$product->getName() . ' has zero price on Wish List page.'
35+
);
36+
}
37+
38+
/**
39+
* Returns a string representation of the object.
40+
*
41+
* @return string
42+
*/
43+
public function toString()
44+
{
45+
return 'Product price is not zero in default Wish List.';
46+
}
47+
}

dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,16 @@ public function __prepare(Customer $customer)
4949
*
5050
* @param Customer $customer
5151
* @param string $product
52+
* @param bool $configure
5253
* @return array
5354
*/
54-
public function test(Customer $customer, $product)
55+
public function test(Customer $customer, $product, $configure = true)
5556
{
5657
$product = $this->createProducts($product)[0];
5758

5859
// Steps:
5960
$this->loginCustomer($customer);
60-
$this->addToWishlist([$product], true);
61+
$this->addToWishlist([$product], $configure);
6162

6263
return ['product' => $product];
6364
}

dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,12 @@
5050
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" />
5151
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" />
5252
</variation>
53+
<variation name="AddProductToWishlistEntityTestVariation8">
54+
<data name="product/0" xsi:type="string">configurableProduct::default</data>
55+
<data name="configure" xsi:type="boolean">false</data>
56+
<constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" />
57+
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" />
58+
<constraint name="Magento\Wishlist\Test\Constraint\AssertProductPriceIsNotZero" />
59+
</variation>
5360
</testCase>
5461
</config>

lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ public function getConstructorArguments(\ReflectionClass $class, $groupByPositio
2525
/**
2626
* Skip native PHP types, classes without constructor
2727
*/
28-
if (!$class->getFileName() || false == $class->hasMethod(
29-
'__construct'
30-
) || !$inherited && $class->getConstructor()->class != $class->getName()
28+
if ($class->isInterface() ||
29+
!$class->getFileName() ||
30+
false == $class->hasMethod('__construct') ||
31+
!$inherited &&
32+
$class->getConstructor()->class != $class->getName()
3133
) {
3234
return $output;
3335
}

lib/internal/Magento/Framework/Code/Test/Unit/Reader/ArgumentsReaderTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,20 @@ public function testGetConstructorArgumentsClassWithoutOwnConstructorInheritedFa
8686
$this->assertEquals([], $actualResult);
8787
}
8888

89+
public function testGetConstructorArgumentsWhenInputTypeIsInterfaceWithParam()
90+
{
91+
$class = new \ReflectionClass('InterfaceTypeWithConstructorMethodAndParams');
92+
$actualResult = $this->_model->getConstructorArguments($class);
93+
$this->assertEquals([], $actualResult);
94+
}
95+
96+
public function testGetConstructorArgumentsWhenInputTypeIsInterfaceWithoutParam()
97+
{
98+
$class = new \ReflectionClass('InterfaceTypeWithConstructorMethodWithoutParams');
99+
$actualResult = $this->_model->getConstructorArguments($class);
100+
$this->assertEquals([], $actualResult);
101+
}
102+
89103
public function testGetConstructorArgumentsClassWithoutOwnConstructorInheritedTrue()
90104
{
91105
$expectedResult = [

lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,21 @@ public function __construct(\stdClass $stdClassObject, \ClassExtendsDefaultPhpTy
223223
$this->argumentTwo = $secondClass;
224224
}
225225
}
226+
227+
interface InterfaceTypeWithConstructorMethodAndParams
228+
{
229+
/**
230+
* We do not expect that this is valid case. There is no need to declare interface with method __construct
231+
*
232+
* @param $paramOne
233+
* @param $paramTwo
234+
*/
235+
public function __construct($paramOne, $paramTwo);
236+
}
237+
interface InterfaceTypeWithConstructorMethodWithoutParams
238+
{
239+
/**
240+
* We do not expect that this is valid case. There is no need to declare interface with method __construct
241+
*/
242+
public function __construct();
243+
}

lib/web/tiny_mce/classes/util/Quirks.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,8 @@
152152
ed.onClick.add(function(ed, e) {
153153
e = e.target;
154154

155-
// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
156-
// WebKit can't even do simple things like selecting an image
157-
// Needs tobe the setBaseAndExtend or it will fail to select floated images
158155
if (/^(IMG|HR)$/.test(e.nodeName))
159-
ed.selection.getSel().setBaseAndExtent(e, 0, e, 1);
156+
ed.selection.select(e);
160157

161158
if (e.nodeName == 'A' && ed.dom.hasClass(e, 'mceItemAnchor'))
162159
ed.selection.select(e);

lib/web/tiny_mce/tiny_mce.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/web/tiny_mce/tiny_mce_jquery.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/web/tiny_mce/tiny_mce_jquery_src.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,11 +1441,8 @@ tinymce.create('static tinymce.util.XHR', {
14411441
ed.onClick.add(function(ed, e) {
14421442
e = e.target;
14431443

1444-
// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
1445-
// WebKit can't even do simple things like selecting an image
1446-
// Needs tobe the setBaseAndExtend or it will fail to select floated images
14471444
if (/^(IMG|HR)$/.test(e.nodeName))
1448-
ed.selection.getSel().setBaseAndExtent(e, 0, e, 1);
1445+
ed.selection.select(e);
14491446

14501447
if (e.nodeName == 'A' && ed.dom.hasClass(e, 'mceItemAnchor'))
14511448
ed.selection.select(e);

lib/web/tiny_mce/tiny_mce_prototype.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/web/tiny_mce/tiny_mce_prototype_src.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,11 +1193,8 @@ tinymce.create('static tinymce.util.XHR', {
11931193
ed.onClick.add(function(ed, e) {
11941194
e = e.target;
11951195

1196-
// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
1197-
// WebKit can't even do simple things like selecting an image
1198-
// Needs tobe the setBaseAndExtend or it will fail to select floated images
11991196
if (/^(IMG|HR)$/.test(e.nodeName))
1200-
ed.selection.getSel().setBaseAndExtent(e, 0, e, 1);
1197+
ed.selection.select(e);
12011198

12021199
if (e.nodeName == 'A' && ed.dom.hasClass(e, 'mceItemAnchor'))
12031200
ed.selection.select(e);

lib/web/tiny_mce/tiny_mce_src.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,11 +1166,8 @@ tinymce.create('static tinymce.util.XHR', {
11661166
ed.onClick.add(function(ed, e) {
11671167
e = e.target;
11681168

1169-
// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
1170-
// WebKit can't even do simple things like selecting an image
1171-
// Needs tobe the setBaseAndExtend or it will fail to select floated images
11721169
if (/^(IMG|HR)$/.test(e.nodeName))
1173-
ed.selection.getSel().setBaseAndExtent(e, 0, e, 1);
1170+
ed.selection.select(e);
11741171

11751172
if (e.nodeName == 'A' && ed.dom.hasClass(e, 'mceItemAnchor'))
11761173
ed.selection.select(e);

0 commit comments

Comments
 (0)