Skip to content

Commit

Permalink
Merge branch '2.2-develop' of https://github.com/magento/magento2 int…
Browse files Browse the repository at this point in the history
…o 2.2-develop
  • Loading branch information
VasilinaHrebets committed Dec 15, 2017
2 parents 370e526 + b1cc3ea commit 5e43f84
Show file tree
Hide file tree
Showing 25 changed files with 400 additions and 37 deletions.
8 changes: 8 additions & 0 deletions .github/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<IfVersion < 2.4>
order allow,deny
deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>

46 changes: 46 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

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.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

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.

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.

## Scope

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.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at engcom@magento.com. 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.

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.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 0 additions & 9 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,6 @@
Require all denied
</IfVersion>
</Files>
<Files CONTRIBUTING.md>
<IfVersion < 2.4>
order allow,deny
deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
</Files>
<Files COPYING.txt>
<IfVersion < 2.4>
order allow,deny
Expand Down
9 changes: 0 additions & 9 deletions .htaccess.sample
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,6 @@
Require all denied
</IfVersion>
</Files>
<Files CONTRIBUTING.md>
<IfVersion < 2.4>
order allow,deny
deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
</Files>
<Files COPYING.txt>
<IfVersion < 2.4>
order allow,deny
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ protected function syncData($indexer, $destinationTable, $ids)
protected function processRelations($indexer, $ids, $onlyParents = false)
{
$parentIds = $indexer->getRelationsByChild($ids);
$parentIds = array_unique(array_merge($parentIds, $ids));
$childIds = $onlyParents ? [] : $indexer->getRelationsByParent($parentIds);
return array_unique(array_merge($ids, $childIds, $parentIds));
}
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Catalog/Model/Product/Option/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Option;
use Magento\Framework\Model\AbstractModel;
use Magento\Catalog\Pricing\Price\BasePrice;

/**
* Catalog product option select type model
Expand Down Expand Up @@ -224,7 +225,7 @@ public function saveValues()
public function getPrice($flag = false)
{
if ($flag && $this->getPriceType() == self::TYPE_PERCENT) {
$basePrice = $this->getOption()->getProduct()->getFinalPrice();
$basePrice = $this->getOption()->getProduct()->getPriceInfo()->getPrice(BasePrice::PRICE_CODE)->getValue();
$price = $basePrice * ($this->_getData(self::KEY_PRICE) / 100);
return $price;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ public function testReindexWithNotNullArgumentExecutesReindexEntities()
->disableOriginalConstructor()
->getMock();

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

$eavDecimal->expects($this->once())->method('getRelationsByChild')->with($reindexIds)->willReturn($reindexIds);
$eavDecimal->expects($this->once())->method('getRelationsByParent')->with($reindexIds)->willReturn([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,27 @@ private function getMockedOption()
private function getMockedProduct()
{
$mockBuilder = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
->setMethods(['getFinalPrice', '__wakeup'])
->setMethods(['getPriceInfo', '__wakeup'])
->disableOriginalConstructor();
$mock = $mockBuilder->getMock();

$mock->expects($this->any())
->method('getFinalPrice')
->will($this->returnValue(10));
$priceInfoMock = $this->getMockForAbstractClass(
\Magento\Framework\Pricing\PriceInfoInterface::class,
[],
'',
false,
false,
true,
['getPrice']
);

$priceMock = $this->getMockForAbstractClass(\Magento\Framework\Pricing\Price\PriceInterface::class);

$priceInfoMock->expects($this->any())->method('getPrice')->willReturn($priceMock);

$mock->expects($this->any())->method('getPriceInfo')->willReturn($priceInfoMock);

$priceMock->expects($this->any())->method('getValue')->willReturn(10);

return $mock;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Media extends AbstractImportValidator implements RowValidatorInterface
*/
const URL_REGEXP = '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i';

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

Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Dhl/Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ public function getDhlProducts($doc)
'L' => __('Express 10:30'),
'G' => __('Domestic economy select'),
'W' => __('Economy select'),
'I' => __('Break bulk economy'),
'I' => __('Domestic express 9:00'),
'N' => __('Domestic express'),
'O' => __('Others'),
'R' => __('Globalmail business'),
Expand All @@ -616,7 +616,7 @@ public function getDhlProducts($doc)
];

$nonDocType = [
'1' => __('Customer services'),
'1' => __('Domestic express 12:00'),
'3' => __('Easy shop'),
'4' => __('Jetline'),
'8' => __('Express easy'),
Expand Down
63 changes: 63 additions & 0 deletions app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,67 @@ public function requestToShipmentDataProvider()
]
];
}

/**
* @dataProvider dhlProductsDataProvider
*
* @param string $docType
* @param array $products
*/
public function testGetDhlProducts(string $docType, array $products)
{
$this->assertEquals($products, $this->model->getDhlProducts($docType));
}

/**
* @return array
*/
public function dhlProductsDataProvider() : array
{
return [
'doc' => [
'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_DOC,
'products' => [
'2' => 'Easy shop',
'5' => 'Sprintline',
'6' => 'Secureline',
'7' => 'Express easy',
'9' => 'Europack',
'B' => 'Break bulk express',
'C' => 'Medical express',
'D' => 'Express worldwide',
'U' => 'Express worldwide',
'K' => 'Express 9:00',
'L' => 'Express 10:30',
'G' => 'Domestic economy select',
'W' => 'Economy select',
'I' => 'Domestic express 9:00',
'N' => 'Domestic express',
'O' => 'Others',
'R' => 'Globalmail business',
'S' => 'Same day',
'T' => 'Express 12:00',
'X' => 'Express envelope',
]
],
'non-doc' => [
'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_NON_DOC,
'products' => [
'1' => 'Domestic express 12:00',
'3' => 'Easy shop',
'4' => 'Jetline',
'8' => 'Express easy',
'P' => 'Express worldwide',
'Q' => 'Medical express',
'E' => 'Express 9:00',
'F' => 'Freight worldwide',
'H' => 'Economy select',
'J' => 'Jumbo box',
'M' => 'Express 10:30',
'V' => 'Europack',
'Y' => 'Express 12:00',
]
]
];
}
}
4 changes: 2 additions & 2 deletions app/code/Magento/Dhl/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ Europack,Europack
"Express 10:30","Express 10:30"
"Domestic economy select","Domestic economy select"
"Economy select","Economy select"
"Break bulk economy","Break bulk economy"
"Domestic express","Domestic express"
Others,Others
"Globalmail business","Globalmail business"
"Same day","Same day"
"Express 12:00","Express 12:00"
"Express envelope","Express envelope"
"Customer services","Customer services"
Jetline,Jetline
"Freight worldwide","Freight worldwide"
"Jumbo box","Jumbo box"
Expand Down Expand Up @@ -81,3 +79,5 @@ Size,Size
"Show Method if Not Applicable","Show Method if Not Applicable"
"Sort Order","Sort Order"
Debug,Debug
"Domestic express 9:00","Domestic express 9:00"
"Domestic express 12:00","Domestic express 12:00"
1 change: 1 addition & 0 deletions app/code/Magento/Quote/Model/CouponManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function get($cartId)
*/
public function set($cartId, $couponCode)
{
$couponCode = trim($couponCode);
/** @var \Magento\Quote\Model\Quote $quote */
$quote = $this->quoteRepository->getActive($cartId);
if (!$quote->getItemsCount()) {
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Search/Block/Term.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ protected function _loadTerms()
continue;
}
$term->setRatio(($term->getPopularity() - $this->_minPopularity) / $range);
$temp[$term->getName()] = $term;
$termKeys[] = $term->getName();
$temp[$term->getData('query_text')] = $term;
$termKeys[] = $term->getData('query_text');
}
natcasesort($termKeys);

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

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Search/view/frontend/templates/term.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<li class="item">
<a href="<?= /* @escapeNotVerified */ $block->getSearchUrl($_term) ?>"
style="font-size:<?= /* @escapeNotVerified */ $_term->getRatio()*70+75 ?>%;">
<?= $block->escapeHtml($_term->getName()) ?>
<?= $block->escapeHtml($_term->getData('query_text')) ?>
</a>
</li>
<?php endforeach; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,46 @@ public function testSetMyCouponSuccess()

$this->assertEquals($quoteWithCoupon->getCouponCode(), $couponCode);
}

/**
* @magentoApiDataFixture Magento/Sales/_files/quote.php
* @magentoApiDataFixture Magento/Checkout/_files/discount_10percent.php
*/
public function testSetCouponWihSpaces()
{
/** @var \Magento\Quote\Model\Quote $quote */
$quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class);
$quote->load('test01', 'reserved_order_id');
$cartId = $quote->getId();
/** @var \Magento\SalesRule\Model\Rule $salesRule */
$salesRule = $this->objectManager->create(\Magento\SalesRule\Model\Rule::class);
$salesRuleId = $this->objectManager->get(\Magento\Framework\Registry::class)
->registry('Magento/Checkout/_file/discount_10percent');
$salesRule->load($salesRuleId);
$couponCode = $salesRule->getPrimaryCoupon()->getCode() ;
$serviceInfo = [
'rest' => [
'resourcePath' => self::RESOURCE_PATH . $cartId . '/coupons/'
. rawurlencode(' ') . $couponCode . rawurlencode(' '),
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT,
],
'soap' => [
'service' => self::SERVICE_NAME,
'serviceVersion' => self::SERVICE_VERSION,
'operation' => self::SERVICE_NAME . 'Set',
],
];

$requestData = [
"cartId" => $cartId,
"couponCode" => $couponCode,
];

$this->assertTrue($this->_webApiCall($serviceInfo, $requestData));

$quoteWithCoupon = $this->objectManager->create(\Magento\Quote\Model\Quote::class);
$quoteWithCoupon->load('test01', 'reserved_order_id');

$this->assertEquals($quoteWithCoupon->getCouponCode(), $couponCode);
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
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
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",,,,,,,,
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",,,,,,,,
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
$items = [
[
'source' => __DIR__ . '/../../../../../Magento/Catalog/_files/magento_image.jpg',
'dest' => $dirPath . '/magento_image.jpg',
'dest' => $dirPath . '/magento_image(1).jpg',
],
[
'source' => __DIR__ . '/../../../../../Magento/Catalog/_files/magento_small_image.jpg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function setUp()
public function testGetSearchUrl()
{
$query = uniqid();
$obj = new \Magento\Framework\DataObject(['name' => $query]);
$obj = new \Magento\Framework\DataObject(['query_text' => $query]);
$this->assertStringEndsWith("/catalogsearch/result/?q={$query}", $this->_block->getSearchUrl($obj));
}
}
Loading

0 comments on commit 5e43f84

Please sign in to comment.