Skip to content

Commit 5e43f84

Browse files
author
VasilinaHrebets
committed
Merge branch '2.2-develop' of https://github.com/magento/magento2 into 2.2-develop
2 parents 370e526 + b1cc3ea commit 5e43f84

File tree

25 files changed

+400
-37
lines changed

25 files changed

+400
-37
lines changed

.github/.htaccess

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<IfVersion < 2.4>
2+
order allow,deny
3+
deny from all
4+
</IfVersion>
5+
<IfVersion >= 2.4>
6+
Require all denied
7+
</IfVersion>
8+

.github/CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/
File renamed without changes.
File renamed without changes.
File renamed without changes.

.htaccess

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,6 @@
274274
Require all denied
275275
</IfVersion>
276276
</Files>
277-
<Files CONTRIBUTING.md>
278-
<IfVersion < 2.4>
279-
order allow,deny
280-
deny from all
281-
</IfVersion>
282-
<IfVersion >= 2.4>
283-
Require all denied
284-
</IfVersion>
285-
</Files>
286277
<Files COPYING.txt>
287278
<IfVersion < 2.4>
288279
order allow,deny

.htaccess.sample

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,6 @@
251251
Require all denied
252252
</IfVersion>
253253
</Files>
254-
<Files CONTRIBUTING.md>
255-
<IfVersion < 2.4>
256-
order allow,deny
257-
deny from all
258-
</IfVersion>
259-
<IfVersion >= 2.4>
260-
Require all denied
261-
</IfVersion>
262-
</Files>
263254
<Files COPYING.txt>
264255
<IfVersion < 2.4>
265256
order allow,deny

app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ protected function syncData($indexer, $destinationTable, $ids)
143143
protected function processRelations($indexer, $ids, $onlyParents = false)
144144
{
145145
$parentIds = $indexer->getRelationsByChild($ids);
146+
$parentIds = array_unique(array_merge($parentIds, $ids));
146147
$childIds = $onlyParents ? [] : $indexer->getRelationsByParent($parentIds);
147148
return array_unique(array_merge($ids, $childIds, $parentIds));
148149
}

app/code/Magento/Catalog/Model/Product/Option/Value.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Catalog\Model\Product;
1212
use Magento\Catalog\Model\Product\Option;
1313
use Magento\Framework\Model\AbstractModel;
14+
use Magento\Catalog\Pricing\Price\BasePrice;
1415

1516
/**
1617
* Catalog product option select type model
@@ -224,7 +225,7 @@ public function saveValues()
224225
public function getPrice($flag = false)
225226
{
226227
if ($flag && $this->getPriceType() == self::TYPE_PERCENT) {
227-
$basePrice = $this->getOption()->getProduct()->getFinalPrice();
228+
$basePrice = $this->getOption()->getProduct()->getPriceInfo()->getPrice(BasePrice::PRICE_CODE)->getValue();
228229
$price = $basePrice * ($this->_getData(self::KEY_PRICE) / 100);
229230
return $price;
230231
}

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ public function testReindexWithNotNullArgumentExecutesReindexEntities()
129129
->disableOriginalConstructor()
130130
->getMock();
131131

132-
$eavSource->expects($this->once())->method('getRelationsByChild')->with($childIds)->willReturn($childIds);
133-
$eavSource->expects($this->once())->method('getRelationsByParent')->with($childIds)->willReturn($parentIds);
132+
$eavSource->expects($this->once())->method('getRelationsByChild')->with($childIds)->willReturn($parentIds);
133+
$eavSource->expects($this->once())->method('getRelationsByParent')
134+
->with(array_unique(array_merge($parentIds, $childIds)))->willReturn($parentIds);
134135

135136
$eavDecimal->expects($this->once())->method('getRelationsByChild')->with($reindexIds)->willReturn($reindexIds);
136137
$eavDecimal->expects($this->once())->method('getRelationsByParent')->with($reindexIds)->willReturn([]);

app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,27 @@ private function getMockedOption()
164164
private function getMockedProduct()
165165
{
166166
$mockBuilder = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
167-
->setMethods(['getFinalPrice', '__wakeup'])
167+
->setMethods(['getPriceInfo', '__wakeup'])
168168
->disableOriginalConstructor();
169169
$mock = $mockBuilder->getMock();
170170

171-
$mock->expects($this->any())
172-
->method('getFinalPrice')
173-
->will($this->returnValue(10));
171+
$priceInfoMock = $this->getMockForAbstractClass(
172+
\Magento\Framework\Pricing\PriceInfoInterface::class,
173+
[],
174+
'',
175+
false,
176+
false,
177+
true,
178+
['getPrice']
179+
);
180+
181+
$priceMock = $this->getMockForAbstractClass(\Magento\Framework\Pricing\Price\PriceInterface::class);
182+
183+
$priceInfoMock->expects($this->any())->method('getPrice')->willReturn($priceMock);
184+
185+
$mock->expects($this->any())->method('getPriceInfo')->willReturn($priceInfoMock);
186+
187+
$priceMock->expects($this->any())->method('getValue')->willReturn(10);
174188

175189
return $mock;
176190
}

app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Media extends AbstractImportValidator implements RowValidatorInterface
1717
*/
1818
const URL_REGEXP = '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i';
1919

20-
const PATH_REGEXP = '#^(?!.*[\\/]\.{2}[\\/])(?!\.{2}[\\/])[-\w.\\/]+$#';
20+
const PATH_REGEXP = '#^(?!.*[\\/]\.{2}[\\/])(?!\.{2}[\\/])[-\w.\\/()]+$#';
2121

2222
const ADDITIONAL_IMAGES = 'additional_images';
2323

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ public function getDhlProducts($doc)
606606
'L' => __('Express 10:30'),
607607
'G' => __('Domestic economy select'),
608608
'W' => __('Economy select'),
609-
'I' => __('Break bulk economy'),
609+
'I' => __('Domestic express 9:00'),
610610
'N' => __('Domestic express'),
611611
'O' => __('Others'),
612612
'R' => __('Globalmail business'),
@@ -616,7 +616,7 @@ public function getDhlProducts($doc)
616616
];
617617

618618
$nonDocType = [
619-
'1' => __('Customer services'),
619+
'1' => __('Domestic express 12:00'),
620620
'3' => __('Easy shop'),
621621
'4' => __('Jetline'),
622622
'8' => __('Express easy'),

app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,4 +447,67 @@ public function requestToShipmentDataProvider()
447447
]
448448
];
449449
}
450+
451+
/**
452+
* @dataProvider dhlProductsDataProvider
453+
*
454+
* @param string $docType
455+
* @param array $products
456+
*/
457+
public function testGetDhlProducts(string $docType, array $products)
458+
{
459+
$this->assertEquals($products, $this->model->getDhlProducts($docType));
460+
}
461+
462+
/**
463+
* @return array
464+
*/
465+
public function dhlProductsDataProvider() : array
466+
{
467+
return [
468+
'doc' => [
469+
'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_DOC,
470+
'products' => [
471+
'2' => 'Easy shop',
472+
'5' => 'Sprintline',
473+
'6' => 'Secureline',
474+
'7' => 'Express easy',
475+
'9' => 'Europack',
476+
'B' => 'Break bulk express',
477+
'C' => 'Medical express',
478+
'D' => 'Express worldwide',
479+
'U' => 'Express worldwide',
480+
'K' => 'Express 9:00',
481+
'L' => 'Express 10:30',
482+
'G' => 'Domestic economy select',
483+
'W' => 'Economy select',
484+
'I' => 'Domestic express 9:00',
485+
'N' => 'Domestic express',
486+
'O' => 'Others',
487+
'R' => 'Globalmail business',
488+
'S' => 'Same day',
489+
'T' => 'Express 12:00',
490+
'X' => 'Express envelope',
491+
]
492+
],
493+
'non-doc' => [
494+
'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_NON_DOC,
495+
'products' => [
496+
'1' => 'Domestic express 12:00',
497+
'3' => 'Easy shop',
498+
'4' => 'Jetline',
499+
'8' => 'Express easy',
500+
'P' => 'Express worldwide',
501+
'Q' => 'Medical express',
502+
'E' => 'Express 9:00',
503+
'F' => 'Freight worldwide',
504+
'H' => 'Economy select',
505+
'J' => 'Jumbo box',
506+
'M' => 'Express 10:30',
507+
'V' => 'Europack',
508+
'Y' => 'Express 12:00',
509+
]
510+
]
511+
];
512+
}
450513
}

app/code/Magento/Dhl/i18n/en_US.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ Europack,Europack
2323
"Express 10:30","Express 10:30"
2424
"Domestic economy select","Domestic economy select"
2525
"Economy select","Economy select"
26-
"Break bulk economy","Break bulk economy"
2726
"Domestic express","Domestic express"
2827
Others,Others
2928
"Globalmail business","Globalmail business"
3029
"Same day","Same day"
3130
"Express 12:00","Express 12:00"
3231
"Express envelope","Express envelope"
33-
"Customer services","Customer services"
3432
Jetline,Jetline
3533
"Freight worldwide","Freight worldwide"
3634
"Jumbo box","Jumbo box"
@@ -81,3 +79,5 @@ Size,Size
8179
"Show Method if Not Applicable","Show Method if Not Applicable"
8280
"Sort Order","Sort Order"
8381
Debug,Debug
82+
"Domestic express 9:00","Domestic express 9:00"
83+
"Domestic express 12:00","Domestic express 12:00"

app/code/Magento/Quote/Model/CouponManagement.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function get($cartId)
5050
*/
5151
public function set($cartId, $couponCode)
5252
{
53+
$couponCode = trim($couponCode);
5354
/** @var \Magento\Quote\Model\Quote $quote */
5455
$quote = $this->quoteRepository->getActive($cartId);
5556
if (!$quote->getItemsCount()) {

app/code/Magento/Search/Block/Term.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ protected function _loadTerms()
9595
continue;
9696
}
9797
$term->setRatio(($term->getPopularity() - $this->_minPopularity) / $range);
98-
$temp[$term->getName()] = $term;
99-
$termKeys[] = $term->getName();
98+
$temp[$term->getData('query_text')] = $term;
99+
$termKeys[] = $term->getData('query_text');
100100
}
101101
natcasesort($termKeys);
102102

@@ -128,7 +128,7 @@ public function getSearchUrl($obj)
128128
* url encoding will be done in Url.php http_build_query
129129
* so no need to explicitly called urlencode for the text
130130
*/
131-
$url->setQueryParam('q', $obj->getName());
131+
$url->setQueryParam('q', $obj->getData('query_text'));
132132
return $url->getUrl('catalogsearch/result');
133133
}
134134

app/code/Magento/Search/view/frontend/templates/term.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<li class="item">
1414
<a href="<?= /* @escapeNotVerified */ $block->getSearchUrl($_term) ?>"
1515
style="font-size:<?= /* @escapeNotVerified */ $_term->getRatio()*70+75 ?>%;">
16-
<?= $block->escapeHtml($_term->getName()) ?>
16+
<?= $block->escapeHtml($_term->getData('query_text')) ?>
1717
</a>
1818
</li>
1919
<?php endforeach; ?>

dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,4 +297,46 @@ public function testSetMyCouponSuccess()
297297

298298
$this->assertEquals($quoteWithCoupon->getCouponCode(), $couponCode);
299299
}
300+
301+
/**
302+
* @magentoApiDataFixture Magento/Sales/_files/quote.php
303+
* @magentoApiDataFixture Magento/Checkout/_files/discount_10percent.php
304+
*/
305+
public function testSetCouponWihSpaces()
306+
{
307+
/** @var \Magento\Quote\Model\Quote $quote */
308+
$quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class);
309+
$quote->load('test01', 'reserved_order_id');
310+
$cartId = $quote->getId();
311+
/** @var \Magento\SalesRule\Model\Rule $salesRule */
312+
$salesRule = $this->objectManager->create(\Magento\SalesRule\Model\Rule::class);
313+
$salesRuleId = $this->objectManager->get(\Magento\Framework\Registry::class)
314+
->registry('Magento/Checkout/_file/discount_10percent');
315+
$salesRule->load($salesRuleId);
316+
$couponCode = $salesRule->getPrimaryCoupon()->getCode() ;
317+
$serviceInfo = [
318+
'rest' => [
319+
'resourcePath' => self::RESOURCE_PATH . $cartId . '/coupons/'
320+
. rawurlencode(' ') . $couponCode . rawurlencode(' '),
321+
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT,
322+
],
323+
'soap' => [
324+
'service' => self::SERVICE_NAME,
325+
'serviceVersion' => self::SERVICE_VERSION,
326+
'operation' => self::SERVICE_NAME . 'Set',
327+
],
328+
];
329+
330+
$requestData = [
331+
"cartId" => $cartId,
332+
"couponCode" => $couponCode,
333+
];
334+
335+
$this->assertTrue($this->_webApiCall($serviceInfo, $requestData));
336+
337+
$quoteWithCoupon = $this->objectManager->create(\Magento\Quote\Model\Quote::class);
338+
$quoteWithCoupon->load('test01', 'reserved_order_id');
339+
340+
$this->assertEquals($quoteWithCoupon->getCouponCode(), $couponCode);
341+
}
300342
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
sku,store_view_code,attribute_set_code,product_type,categories,product_websites,name,description,short_description,weight,product_online,tax_class_name,visibility,price,special_price,special_price_from_date,special_price_to_date,url_key,meta_title,meta_keywords,meta_description,base_image,base_image_label,small_image,small_image_label,thumbnail_image,thumbnail_image_label,swatch_image,swatch_image_label1,created_at,updated_at,new_from_date,new_to_date,display_product_options_in,map_price,msrp_price,map_enabled,gift_message_available,custom_design,custom_design_from,custom_design_to,custom_layout_update,page_layout,product_options_container,msrp_display_actual_price_type,country_of_manufacture,additional_attributes,qty,out_of_stock_qty,use_config_min_qty,is_qty_decimal,allow_backorders,use_config_backorders,min_cart_qty,use_config_min_sale_qty,max_cart_qty,use_config_max_sale_qty,is_in_stock,notify_on_stock_below,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,website_id,related_skus,crosssell_skus,upsell_skus,additional_images,additional_image_labels,hide_from_product_page,custom_options,bundle_price_type,bundle_sku_type,bundle_price_view,bundle_weight_type,bundle_values,associated_skus
2-
simple_new,,Default,simple,,base,New Product,,,,1,Taxable Goods,"Catalog, Search",10,,,,new-product,New Product,New Product,New Product ,magento_image.jpg,Image Label,magento_small_image.jpg,Small Image Label,magento_thumbnail.jpg,Thumbnail Label,magento_image.jpg,Image Label,10/20/15 07:05,10/20/15 07:05,,,Block after Info Column,,,,,,,,,,,,,"has_options=1,quantity_and_stock_status=In Stock,required_options=1",100,0,1,0,0,1,1,1,10000,1,1,1,1,1,0,1,1,0,0,0,1,,,,"magento_additional_image_one.jpg, magento_additional_image_two.jpg","Additional Image Label One,Additional Image Label Two",,,,,,,,
2+
simple_new,,Default,simple,,base,New Product,,,,1,Taxable Goods,"Catalog, Search",10,,,,new-product,New Product,New Product,New Product ,magento_image(1).jpg,Image Label,magento_small_image.jpg,Small Image Label,magento_thumbnail.jpg,Thumbnail Label,magento_image(1).jpg,Image Label,10/20/15 07:05,10/20/15 07:05,,,Block after Info Column,,,,,,,,,,,,,"has_options=1,quantity_and_stock_status=In Stock,required_options=1",100,0,1,0,0,1,1,1,10000,1,1,1,1,1,0,1,1,0,0,0,1,,,,"magento_additional_image_one.jpg, magento_additional_image_two.jpg","Additional Image Label One,Additional Image Label Two",,,,,,,,

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_with_filesystem_images.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
$items = [
2121
[
2222
'source' => __DIR__ . '/../../../../../Magento/Catalog/_files/magento_image.jpg',
23-
'dest' => $dirPath . '/magento_image.jpg',
23+
'dest' => $dirPath . '/magento_image(1).jpg',
2424
],
2525
[
2626
'source' => __DIR__ . '/../../../../../Magento/Catalog/_files/magento_small_image.jpg',

dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function setUp()
2424
public function testGetSearchUrl()
2525
{
2626
$query = uniqid();
27-
$obj = new \Magento\Framework\DataObject(['name' => $query]);
27+
$obj = new \Magento\Framework\DataObject(['query_text' => $query]);
2828
$this->assertStringEndsWith("/catalogsearch/result/?q={$query}", $this->_block->getSearchUrl($obj));
2929
}
3030
}

0 commit comments

Comments
 (0)