Skip to content

Commit f395dff

Browse files
authored
Merge pull request #7855 from magento-gl/Spartans_2_4_6_Quality_Backlog
Spartans 2 4 6 quality backlog
2 parents f26ae80 + 6ad4ebf commit f395dff

File tree

9 files changed

+66
-13
lines changed

9 files changed

+66
-13
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,9 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
424424
}
425425
}
426426
$quote->setCustomerIsGuest(true);
427-
$groupId = $customer ? $customer->getGroupId() : GroupInterface::NOT_LOGGED_IN_ID;
428-
$quote->setCustomerGroupId($groupId);
427+
$quote->setCustomerGroupId(
428+
$quote->getCustomerId() ? $customer->getGroupId() : GroupInterface::NOT_LOGGED_IN_ID
429+
);
429430
}
430431

431432
$remoteAddress = $this->remoteAddress->getRemoteAddress();

app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,16 @@ protected function setUp(): void
240240
);
241241

242242
$this->quoteMock = $this->getMockBuilder(Quote::class)
243-
->addMethods(['setCustomerEmail', 'setCustomerGroupId', 'setCustomerId', 'setRemoteIp', 'setXForwardedFor'])
243+
->addMethods(
244+
[
245+
'setCustomerEmail',
246+
'setCustomerGroupId',
247+
'setCustomerId',
248+
'getCustomerId',
249+
'setRemoteIp',
250+
'setXForwardedFor',
251+
]
252+
)
244253
->onlyMethods(
245254
[
246255
'assignCustomer',
@@ -853,6 +862,7 @@ public function testPlaceOrderIfCustomerIsGuest(): void
853862
$this->quoteMock->expects($this->any())->method('getBillingAddress')->with()->willReturn($addressMock);
854863

855864
$this->quoteMock->expects($this->once())->method('setCustomerIsGuest')->with(true)->willReturnSelf();
865+
$this->quoteMock->expects($this->once())->method('getCustomerId')->willReturn(null);
856866
$this->quoteMock->expects($this->once())
857867
->method('setCustomerGroupId')
858868
->with(GroupInterface::NOT_LOGGED_IN_ID);

app/code/Magento/Tax/Pricing/Render/Adjustment.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ public function displayPriceExcludingTax()
183183
*/
184184
public function getDataPriceType(): string
185185
{
186-
return $this->amountRender->getPriceType() === 'finalPrice'
187-
? 'basePrice'
188-
: 'base' . ucfirst($this->amountRender->getPriceType());
186+
$priceType = $this->amountRender->getPriceType();
187+
return $priceType === 'finalPrice' ? 'basePrice' : ($priceType ? 'base' . ucfirst($priceType) : '');
189188
}
190189
}

app/code/Magento/Tax/Test/Unit/Pricing/Render/AdjustmentTest.php

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
class AdjustmentTest extends TestCase
3030
{
3131
/**
32-
* Context mock
33-
*
3432
* @var \Magento\Framework\View\Element\Template\Context
3533
*/
3634
protected $contextMock;
@@ -54,6 +52,11 @@ class AdjustmentTest extends TestCase
5452
*/
5553
protected $model;
5654

55+
/**
56+
* @var AmountRenderInterface
57+
*/
58+
protected $amountRender;
59+
5760
/**
5861
* Init mocks and model
5962
*/
@@ -350,4 +353,33 @@ public function testGetHtmlBoth()
350353

351354
$this->model->render($amountRender, $arguments);
352355
}
356+
357+
/**
358+
* test for method getDataPriceType
359+
* @dataProvider dataPriceTypeDataProvider
360+
*/
361+
public function testGetDataPriceType(?string $priceType, string $priceTypeValue): void
362+
{
363+
$amountRender = $this->getMockBuilder(Amount::class)
364+
->addMethods(['getPriceType'])
365+
->disableOriginalConstructor()
366+
->getMock();
367+
$amountRender->expects($this->atLeastOnce())
368+
->method('getPriceType')
369+
->willReturn($priceType);
370+
$this->model->render($amountRender, []);
371+
//no exception is thrown
372+
$this->assertEquals($priceTypeValue, $this->model->getDataPriceType());
373+
$this->assertIsString($this->model->getDataPriceType());
374+
}
375+
376+
/**
377+
* data provider for testGetDataPriceType
378+
*
379+
* @return array
380+
*/
381+
public function dataPriceTypeDataProvider(): array
382+
{
383+
return [['finalPrice', 'basePrice'], [null, '']];
384+
}
353385
}

app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ define([
801801
var max = 0,
802802
pos;
803803

804-
this.elems.each(function (record) {
804+
this.recordData.each(function (record) {
805805
pos = ~~record.position;
806806
pos > max ? max = pos : false;
807807
});

dev/tests/integration/testsuite/Magento/Quote/Model/QuoteManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function testSubmitGuestCustomer(): void
132132
$quote = $this->getQuoteByReservedOrderId->execute('guest_quote');
133133
$this->cartManagement->placeOrder($quote->getId());
134134
$quoteAfterOrderPlaced = $this->getQuoteByReservedOrderId->execute('guest_quote');
135-
self::assertEquals(2, $quoteAfterOrderPlaced->getCustomerGroupId());
135+
self::assertEquals(0, $quoteAfterOrderPlaced->getCustomerGroupId());
136136
self::assertEquals(3, $quoteAfterOrderPlaced->getCustomerTaxClassId());
137137
}
138138

setup/src/Magento/Setup/Module/I18n/Parser/Adapter/Xml.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@
1616
class Xml extends AbstractAdapter
1717
{
1818
/**
19-
* {@inheritdoc}
19+
* @inheritdoc
2020
*/
2121
protected function _parse()
2222
{
23-
foreach ($this->_getNodes($this->_file) as $element) {
23+
foreach ($this->_getNodes($this->_file) as $key => $element) {
2424
if (!$element instanceof \SimpleXMLElement) {
2525
continue;
2626
}
27+
2728
$attributes = $element->attributes();
2829
if ((string)$attributes['translate'] === 'true' || (string)$attributes['translatable'] === 'true') {
2930
$this->_addPhrase((string)$element);
31+
} elseif ($key === 'title') {
32+
$this->_addPhrase((string)$element->title);
3033
} else {
3134
$this->parseTranslatableNodes($attributes, $element);
3235
}
@@ -46,8 +49,12 @@ protected function _getNodes($file)
4649
libxml_use_internal_errors(false);
4750
if ($xml) {
4851
$nodes = $xml->xpath('//*[@translate|@translatable]');
49-
unset($xml);
52+
/* To add title of all xml files in translation csv */
53+
if ($xml->head) {
54+
$nodes['title'] = $xml->head;
55+
}
5056

57+
unset($xml);
5158
return is_array($nodes) ? $nodes : [];
5259
}
5360

setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/XmlTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function parseDataProvider()
6060
['phrase' => 'Phrase 3', 'file' => $default, 'line' => '', 'quote' => ''],
6161
['phrase' => 'Phrase 1', 'file' => $default, 'line' => '', 'quote' => ''],
6262
['phrase' => 'Comment from new line.', 'file' => $default, 'line' => '', 'quote' => ''],
63+
['phrase' => 'Title', 'file' => $default, 'line' => '', 'quote' => ''],
6364
],
6465
],
6566
[

setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/_files/default.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
-->
88

99
<layout>
10+
<head>
11+
<title>Title</title>
12+
</head>
1013
<node1 translate="description, label">
1114
<description>Phrase 1</description>
1215
<label>Phrase 2</label>

0 commit comments

Comments
 (0)