Skip to content

Commit 81c46c8

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-66191
2 parents 86e79d9 + d7f2541 commit 81c46c8

File tree

102 files changed

+2936
-445
lines changed

Some content is hidden

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

102 files changed

+2936
-445
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/Checkout/Controller/Account/Create.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Checkout\Controller\Account;
77

8+
use Magento\Framework\Controller\ResultFactory;
89
use Magento\Framework\Exception\AlreadyExistsException;
910
use Magento\Framework\Exception\NoSuchEntityException;
1011

@@ -55,7 +56,7 @@ public function __construct(
5556
public function execute()
5657
{
5758
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
58-
$resultJson = $this->_objectManager->get(\Magento\Framework\Controller\Result\JsonFactory::class)->create();
59+
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
5960

6061
if ($this->customerSession->isLoggedIn()) {
6162
return $resultJson->setData(
@@ -83,7 +84,7 @@ public function execute()
8384
]
8485
);
8586
} catch (\Exception $e) {
86-
$this->messageManager->addException($e, $e->getMessage());
87+
$this->messageManager->addExceptionMessage($e, $e->getMessage());
8788
throw $e;
8889
}
8990
}

app/code/Magento/Checkout/Test/Unit/Controller/Account/CreateTest.php

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Checkout\Test\Unit\Controller\Account;
77

8+
use Magento\Framework\Controller\ResultFactory;
9+
810
/**
911
* Shopping cart edit tests
1012
*/
@@ -36,9 +38,14 @@ class CreateTest extends \PHPUnit\Framework\TestCase
3638
protected $orderCustomerService;
3739

3840
/**
39-
* @var \PHPUnit_Framework_MockObject_MockObject
41+
* @var \Magento\Framework\Controller\ResultFactory|\PHPUnit_Framework_MockObject_MockObject
42+
*/
43+
private $resultFactory;
44+
45+
/**
46+
* @var \Magento\Framework\Controller\ResultInterface|\PHPUnit_Framework_MockObject_MockObject
4047
*/
41-
protected $objectManagerMock;
48+
private $resultPage;
4249

4350
protected function setUp()
4451
{
@@ -48,9 +55,19 @@ protected function setUp()
4855
$this->orderCustomerService = $this->createMock(\Magento\Sales\Api\OrderCustomerManagementInterface::class);
4956
$this->messageManager = $this->createMock(\Magento\Framework\Message\ManagerInterface::class);
5057

51-
$this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
52-
$contextMock = $this->createPartialMock(\Magento\Framework\App\Action\Context::class, ['getObjectManager']);
53-
$contextMock->expects($this->once())->method('getObjectManager')->willReturn($this->objectManagerMock);
58+
$contextMock = $this->createPartialMock(
59+
\Magento\Framework\App\Action\Context::class,
60+
['getObjectManager', 'getResultFactory']
61+
);
62+
$this->resultFactory = $this->getMockBuilder(\Magento\Framework\Controller\ResultFactory::class)
63+
->disableOriginalConstructor()
64+
->getMock();
65+
$contextMock->expects($this->once())
66+
->method('getResultFactory')
67+
->willReturn($this->resultFactory);
68+
$this->resultPage = $this->getMockBuilder(\Magento\Framework\Controller\ResultInterface::class)
69+
->setMethods(['setData'])
70+
->getMockForAbstractClass();
5471

5572
$this->action = $objectManagerHelper->getObject(
5673
\Magento\Checkout\Controller\Account\Create::class,
@@ -66,53 +83,48 @@ protected function setUp()
6683

6784
public function testExecuteAddsSessionMessageIfCustomerIsLoggedIn()
6885
{
69-
$jsonFactoryMock = $this->createMock(\Magento\Framework\Controller\Result\JsonFactory::class);
70-
$this->objectManagerMock->expects($this->once())
71-
->method('get')
72-
->with(\Magento\Framework\Controller\Result\JsonFactory::class)
73-
->willReturn($jsonFactoryMock);
74-
$jsonMock = $this->createMock(\Magento\Framework\Controller\Result\Json::class);
75-
$jsonFactoryMock->expects($this->once())->method('create')->willReturn($jsonMock);
76-
77-
$this->customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(true));
78-
79-
$jsonMock->expects($this->once())
86+
$resultJson = '{"errors": "true", "message": "Customer is already registered"}';
87+
$this->customerSession->expects($this->once())
88+
->method('isLoggedIn')
89+
->will($this->returnValue(true));
90+
$this->resultFactory->expects($this->once())
91+
->method('create')
92+
->with(ResultFactory::TYPE_JSON)
93+
->willReturn($this->resultPage);
94+
$this->resultPage->expects($this->once())
8095
->method('setData')
8196
->with(
8297
[
8398
'errors' => true,
8499
'message' => __('Customer is already registered')
85100
]
86-
)->willReturnSelf();
87-
$this->action->execute();
101+
)->willReturn($resultJson);
102+
$this->assertEquals($resultJson, $this->action->execute());
88103
}
89104

90105
public function testExecute()
91106
{
92-
$jsonFactoryMock = $this->createMock(\Magento\Framework\Controller\Result\JsonFactory::class);
93-
$this->objectManagerMock->expects($this->once())
94-
->method('get')
95-
->with(\Magento\Framework\Controller\Result\JsonFactory::class)
96-
->willReturn($jsonFactoryMock);
97-
$jsonMock = $this->createMock(\Magento\Framework\Controller\Result\Json::class);
98-
$jsonFactoryMock->expects($this->once())->method('create')->willReturn($jsonMock);
99-
100107
$this->customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false));
101108
$this->checkoutSession->expects($this->once())->method('getLastOrderId')->will($this->returnValue(100));
102109
$customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class);
103-
$this->orderCustomerService->expects($this->once())->method('create')->with(100)->will(
104-
$this->returnValue($customer)
105-
);
106-
107-
$jsonMock->expects($this->once())
110+
$this->orderCustomerService->expects($this->once())
111+
->method('create')
112+
->with(100)
113+
->will($this->returnValue($customer));
114+
115+
$resultJson = '{"errors":"false", "message":"A letter with further instructions will be sent to your email."}';
116+
$this->resultFactory->expects($this->once())
117+
->method('create')
118+
->with(ResultFactory::TYPE_JSON)
119+
->willReturn($this->resultPage);
120+
$this->resultPage->expects($this->once())
108121
->method('setData')
109122
->with(
110123
[
111124
'errors' => false,
112125
'message' => __('A letter with further instructions will be sent to your email.')
113126
]
114-
)->willReturnSelf();
115-
116-
$this->action->execute();
127+
)->willReturn($resultJson);
128+
$this->assertEquals($resultJson, $this->action->execute());
117129
}
118130
}

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"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
namespace Magento\GraphQlCatalog\Model\Resolver\Products\Query;
7+
namespace Magento\Framework\GraphQl\Query;
88

99
/**
1010
* Processor or processors to re-format and add additional data outside of the scope of the query's fetch.
@@ -14,8 +14,8 @@ interface PostFetchProcessorInterface
1414
/**
1515
* Process data by formatting and add any necessary additional attributes.
1616
*
17-
* @param array $productData
17+
* @param array $resultData
1818
* @return array
1919
*/
20-
public function process(array $productData);
20+
public function process(array $resultData);
2121
}

0 commit comments

Comments
 (0)