Skip to content

Commit 42c1ec6

Browse files
author
Magento CICD
authored
merge magento/2.3-develop into magento-obsessive-owls/MAGETWO-70174-data-migration
2 parents f4aaa57 + c10eacb commit 42c1ec6

File tree

96 files changed

+2896
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2896
-402
lines changed

app/code/Magento/Catalog/view/base/web/template/product/link.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
-->
7-
<a class="product-item-link"
7+
<a if="isAllowed()"
8+
class="product-item-link"
89
attr="href: $row().url"
910
text="label"/>

app/code/Magento/CatalogImportExport/Model/Import/Uploader.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ public function move($fileName, $renameFileOff = false)
161161
$read = $this->_readFactory->create($url, DriverPool::HTTPS);
162162
}
163163

164+
//only use filename (for URI with query parameters)
165+
$parsedUrlPath = parse_url($url, PHP_URL_PATH);
166+
if ($parsedUrlPath) {
167+
$urlPathValues = explode('/', $parsedUrlPath);
168+
if (!empty($urlPathValues)) {
169+
$fileName = end($urlPathValues);
170+
}
171+
}
172+
164173
$fileName = preg_replace('/[^a-z0-9\._-]+/i', '', $fileName);
165174
$this->_directory->writeFile(
166175
$this->_directory->getRelativePath($this->getTmpDir() . '/' . $fileName),

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/UploaderTest.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,32 @@ public function moveFileUrlDataProvider()
217217
[
218218
'$fileUrl' => 'http://test_uploader_file',
219219
'$expectedHost' => 'test_uploader_file',
220-
'$expectedFileName' => 'httptest_uploader_file',
220+
'$expectedFileName' => 'test_uploader_file',
221221
],
222222
[
223223
'$fileUrl' => 'https://!:^&`;file',
224224
'$expectedHost' => '!:^&`;file',
225-
'$expectedFileName' => 'httpsfile',
225+
'$expectedFileName' => 'file',
226+
],
227+
[
228+
'$fileUrl' => 'https://www.google.com/image.jpg',
229+
'$expectedHost' => 'www.google.com/image.jpg',
230+
'$expectedFileName' => 'image.jpg',
231+
],
232+
[
233+
'$fileUrl' => 'https://www.google.com/image.jpg?param=1',
234+
'$expectedHost' => 'www.google.com/image.jpg?param=1',
235+
'$expectedFileName' => 'image.jpg',
236+
],
237+
[
238+
'$fileUrl' => 'https://www.google.com/image.jpg?param=1&param=2',
239+
'$expectedHost' => 'www.google.com/image.jpg?param=1&param=2',
240+
'$expectedFileName' => 'image.jpg',
241+
],
242+
[
243+
'$fileUrl' => 'http://www.google.com/image.jpg?param=1&param=2',
244+
'$expectedHost' => 'www.google.com/image.jpg?param=1&param=2',
245+
'$expectedFileName' => 'image.jpg',
226246
],
227247
];
228248
}

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/Eav/Test/Unit/Model/TypeLocatorTest.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Eav\Test\Unit\Model;
108

9+
use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface;
1110
use Magento\Eav\Model\TypeLocator;
1211
use Magento\Eav\Model\TypeLocator\ComplexType as ComplexTypeLocator;
1312
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
@@ -66,7 +65,10 @@ public function testGetType(
6665
$expected
6766
) {
6867
$this->complexType->expects($this->once())->method('getType')->willReturn($expected);
69-
$type = $this->customAttributeTypeLocator->getType($attributeCode, $serviceEntityTypeMapData[$serviceClass]);
68+
$type = $this->customAttributeTypeLocator->getType(
69+
$attributeCode,
70+
$serviceEntityTypeMapData[$serviceClass]
71+
);
7072

7173
$this->assertEquals($expected, $type, 'Expected: ' . $expected . 'but got: ' . $type);
7274
}
@@ -79,16 +81,22 @@ public function getTypeDataProvider()
7981
{
8082
$serviceInterface = \Magento\Catalog\Api\Data\ProductInterface::class;
8183
$eavEntityType = 'catalog_product';
82-
$mediaBackEndModelClass = \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface::class;
83-
$mediaAttributeDataInterface = \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface::class;
84+
$mediaBackEndModelClass = ProductAttributeMediaGalleryEntryInterface::class;
85+
$mediaAttributeDataInterface = ProductAttributeMediaGalleryEntryInterface::class;
8486

85-
$attribute = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class, ['getBackendModel']);
87+
$attribute = $this->createPartialMock(
88+
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class,
89+
['getBackendModel']
90+
);
8691

8792
$attribute->expects($this->any())
8893
->method('getBackendModel')
8994
->willReturn($mediaBackEndModelClass);
9095

91-
$attributeNoBackendModel = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class, ['getBackendModel', 'getFrontendInput']);
96+
$attributeNoBackendModel = $this->createPartialMock(
97+
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class,
98+
['getBackendModel', 'getFrontendInput']
99+
);
92100

93101
$attributeNoBackendModel->expects($this->any())
94102
->method('getBackendModel')

app/code/Magento/GraphQl/Controller/GraphQl.php

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
use Magento\Framework\App\Request\Http;
1111
use Magento\Framework\App\RequestInterface;
1212
use Magento\Framework\App\ResponseInterface;
13-
use Magento\Framework\Exception\LocalizedException;
1413
use Magento\Framework\Serialize\SerializerInterface;
1514
use Magento\Framework\Webapi\Response;
1615
use Magento\GraphQl\Model\SchemaGeneratorInterface;
17-
use Magento\Framework\GraphQl\RequestProcessor;
16+
use Magento\Framework\GraphQl\QueryProcessor;
1817
use Magento\Framework\GraphQl\ExceptionFormatter;
1918
use Magento\GraphQl\Model\ResolverContext;
19+
use Magento\Framework\GraphQl\HttpRequestProcessor;
2020

2121
/**
2222
* Front controller for web API GraphQL area.
@@ -39,38 +39,50 @@ class GraphQl implements FrontControllerInterface
3939
private $jsonSerializer;
4040

4141
/**
42-
* @var RequestProcessor
42+
* @var QueryProcessor
4343
*/
44-
private $requestProcessor;
44+
private $queryProcessor;
4545

46-
/** @var ExceptionFormatter */
46+
/**
47+
* @var ExceptionFormatter
48+
*/
4749
private $graphQlError;
4850

49-
/** @var ResolverContext */
51+
/**
52+
* @var ResolverContext
53+
*/
5054
private $context;
5155

56+
/**
57+
* @var HttpRequestProcessor
58+
*/
59+
private $requestProcessor;
60+
5261
/**
5362
* @param Response $response
5463
* @param SchemaGeneratorInterface $schemaGenerator
5564
* @param SerializerInterface $jsonSerializer
56-
* @param RequestProcessor $requestProcessor
65+
* @param QueryProcessor $queryProcessor
5766
* @param ExceptionFormatter $graphQlError
5867
* @param ResolverContext $context
68+
* @param HttpRequestProcessor $requestProcessor
5969
*/
6070
public function __construct(
6171
Response $response,
6272
SchemaGeneratorInterface $schemaGenerator,
6373
SerializerInterface $jsonSerializer,
64-
RequestProcessor $requestProcessor,
74+
QueryProcessor $queryProcessor,
6575
ExceptionFormatter $graphQlError,
66-
ResolverContext $context
76+
ResolverContext $context,
77+
HttpRequestProcessor $requestProcessor
6778
) {
6879
$this->response = $response;
6980
$this->schemaGenerator = $schemaGenerator;
7081
$this->jsonSerializer = $jsonSerializer;
71-
$this->requestProcessor = $requestProcessor;
82+
$this->queryProcessor = $queryProcessor;
7283
$this->graphQlError = $graphQlError;
7384
$this->context = $context;
85+
$this->requestProcessor = $requestProcessor;
7486
}
7587

7688
/**
@@ -82,17 +94,11 @@ public function __construct(
8294
public function dispatch(RequestInterface $request)
8395
{
8496
try {
85-
/** @var $request Http */
86-
if ($request->getHeader('Content-Type')
87-
&& strpos($request->getHeader('Content-Type'), 'application/json') !== false
88-
) {
89-
$content = $request->getContent();
90-
$data = $this->jsonSerializer->unserialize($content);
91-
} else {
92-
throw new LocalizedException(__('Request content type must be application/json'));
93-
}
97+
/** @var Http $request */
98+
$this->requestProcessor->processHeaders($request);
99+
$data = $this->jsonSerializer->unserialize($request->getContent());
94100
$schema = $this->schemaGenerator->generate();
95-
$result = $this->requestProcessor->process(
101+
$result = $this->queryProcessor->process(
96102
$schema,
97103
isset($data['query']) ? $data['query'] : '',
98104
null,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\GraphQl\Controller\HttpHeaderProcessor;
8+
9+
use Magento\Framework\GraphQl\HttpHeaderProcessorInterface;
10+
use Magento\Framework\Exception\LocalizedException;
11+
12+
/**
13+
* Processes the "Content-Type" header entry
14+
*/
15+
class ContentTypeProcessor implements HttpHeaderProcessorInterface
16+
{
17+
/**
18+
* Handle the mandatory application/json header
19+
*
20+
* {@inheritDoc}
21+
* @throws LocalizedException
22+
*/
23+
public function processHeaderValue($headerValue)
24+
{
25+
if (!$headerValue || strpos($headerValue, 'application/json') === false) {
26+
throw new LocalizedException(
27+
new \Magento\Framework\Phrase('Request content type must be application/json')
28+
);
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)