Skip to content

Commit df19533

Browse files
committed
Merge branch '2.3-develop-php74' of github.com:magento-commerce/magento2ce into MC-40562
2 parents f4b1567 + 09464e0 commit df19533

File tree

19 files changed

+118
-70
lines changed

19 files changed

+118
-70
lines changed

app/code/Magento/Captcha/Model/DefaultModel.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,12 @@ public function getWord()
501501
private function getWords()
502502
{
503503
$sessionData = $this->session->getData($this->getFormIdKey(self::SESSION_WORD));
504-
return time() < $sessionData['expires'] ? $sessionData['words'] : null;
504+
$words = '';
505+
if (isset($sessionData['expires'], $sessionData['words']) && time() < $sessionData['expires']) {
506+
$words = $sessionData['words'];
507+
}
508+
509+
return $words;
505510
}
506511

507512
/**

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,13 @@ public function getLayer()
136136
*/
137137
public function getLoadedProductCollection()
138138
{
139-
return $this->_getProductCollection();
139+
$collection = $this->_getProductCollection();
140+
$categoryId = $this->getLayer()->getCurrentCategory()->getId();
141+
foreach ($collection as $product) {
142+
$product->setData('category_id', $categoryId);
143+
}
144+
145+
return $collection;
140146
}
141147

142148
/**

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,12 @@ public function execute()
194194
$attributeCode = $model && $model->getId()
195195
? $model->getAttributeCode()
196196
: $this->getRequest()->getParam('attribute_code');
197-
$attributeCode = $attributeCode ?: $this->generateCode($this->getRequest()->getParam('frontend_label')[0]);
197+
198+
if (!$attributeCode) {
199+
$frontendLabel = $this->getRequest()->getParam('frontend_label')[0] ?? '';
200+
$attributeCode = $this->generateCode($frontendLabel);
201+
}
202+
198203
$data['attribute_code'] = $attributeCode;
199204

200205
//validate frontend_input

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,9 +725,14 @@ public function getIdBySku($sku)
725725
*/
726726
public function getCategoryId()
727727
{
728+
if ($this->hasData('category_id')) {
729+
return $this->getData('category_id');
730+
}
728731
$category = $this->_registry->registry('current_category');
729-
if ($category && in_array($category->getId(), $this->getCategoryIds())) {
730-
return $category->getId();
732+
$categoryId = $category ? $category->getId() : null;
733+
if ($categoryId && in_array($categoryId, $this->getCategoryIds())) {
734+
$this->setData('category_id', $categoryId);
735+
return $categoryId;
731736
}
732737
return false;
733738
}

app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Sales\Model\Order;
1111
use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender;
1212

13+
/**
14+
* Controller for save creditmemo
15+
*/
1316
class Save extends \Magento\Backend\App\Action implements HttpPostActionInterface
1417
{
1518
/**
@@ -54,6 +57,7 @@ public function __construct(
5457

5558
/**
5659
* Save creditmemo
60+
*
5761
* We can save only new creditmemo. Existing creditmemos are not editable
5862
*
5963
* @return \Magento\Backend\Model\View\Result\Redirect|\Magento\Backend\Model\View\Result\Forward
@@ -104,7 +108,8 @@ public function execute()
104108
\Magento\Sales\Api\CreditmemoManagementInterface::class
105109
);
106110
$creditmemo->getOrder()->setCustomerNoteNotify(!empty($data['send_email']));
107-
$creditmemoManagement->refund($creditmemo, (bool)$data['do_offline']);
111+
$doOffline = isset($data['do_offline']) ? (bool)$data['do_offline'] : false;
112+
$creditmemoManagement->refund($creditmemo, $doOffline);
108113

109114
if (!empty($data['send_email'])) {
110115
$this->creditmemoSender->send($creditmemo);

app/code/Magento/Wishlist/Model/LocaleQuantityProcessor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
namespace Magento\Wishlist\Model;
88

99
/**
10+
* Class LocaleQuantityProcessor for localized quantity to internal format
11+
*
1012
* @api
1113
* @since 100.0.2
1214
*/
@@ -43,7 +45,7 @@ public function __construct(
4345
public function process($qty)
4446
{
4547
$this->localFilter->setOptions(['locale' => $this->localeResolver->getLocale()]);
46-
$qty = $this->localFilter->filter((double)$qty);
48+
$qty = $this->localFilter->filter((string)$qty);
4749
if ($qty < 0) {
4850
$qty = null;
4951
}

dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function dispatch($uri)
109109
$request = $this->getRequest();
110110
$request->setRequestUri($uri);
111111
if ($request->isPost()
112-
&& !array_key_exists('form_key', $request->getPost())
112+
&& !property_exists($request->getPost(), 'form_key')
113113
) {
114114
/** @var FormKey $formKey */
115115
$formKey = $this->_objectManager->get(FormKey::class);

dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ public function testGetAdditionalHtml()
9292

9393
public function testSetCollection()
9494
{
95-
$this->_block->setCollection('test');
96-
$this->assertEquals('test', $this->_block->getLoadedProductCollection());
95+
$collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
96+
->create(\Magento\Framework\Data\Collection::class);
97+
$this->_block->setCollection($collection);
98+
$this->assertEquals($collection, $this->_block->getLoadedProductCollection());
9799
}
98100

99101
public function testGetPriceBlockTemplate()

dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public function testGetParentIds()
114114
$this->assertEmpty($this->_model->getParentIds());
115115
$this->_model->unsetData();
116116
$this->_model->load(4);
117-
$this->assertTrue(in_array(3, $this->_model->getParentIds()));
118-
$this->assertFalse(in_array(4, $this->_model->getParentIds()));
117+
$this->assertContainsEquals(3, $this->_model->getParentIds());
118+
$this->assertNotContainsEquals(4, $this->_model->getParentIds());
119119
}
120120

121121
public function testGetChildren()
@@ -167,9 +167,9 @@ public function testGetLevel()
167167
public function testGetAnchorsAbove()
168168
{
169169
$this->_model->load(4);
170-
$this->assertTrue(in_array(3, $this->_model->getAnchorsAbove()));
170+
$this->assertContainsEquals(3, $this->_model->getAnchorsAbove());
171171
$this->_model->load(5);
172-
$this->assertTrue(in_array(4, $this->_model->getAnchorsAbove()));
172+
$this->assertContainsEquals(4, $this->_model->getAnchorsAbove());
173173
}
174174

175175
public function testGetParentCategories()

dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Observer/ProductProcessUrlRewriteSavingObserverTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testUrlKeyHasChangedInGlobalContext()
8585
];
8686
$actual = $this->getActualResults($productFilter);
8787
foreach ($expected as $row) {
88-
$this->assertTrue(in_array($row, $actual));
88+
$this->assertContainsEquals($row, $actual);
8989
}
9090

9191
$product->setData('save_rewrites_history', true);
@@ -126,7 +126,7 @@ public function testUrlKeyHasChangedInGlobalContext()
126126

127127
$actual = $this->getActualResults($productFilter);
128128
foreach ($expected as $row) {
129-
$this->assertTrue(in_array($row, $actual));
129+
$this->assertContainsEquals($row, $actual);
130130
}
131131
}
132132

@@ -182,7 +182,7 @@ public function testUrlKeyHasChangedInStoreviewContextWithPermanentRedirection()
182182

183183
$actual = $this->getActualResults($productFilter);
184184
foreach ($expected as $row) {
185-
$this->assertTrue(in_array($row, $actual));
185+
$this->assertContainsEquals($row, $actual);
186186
}
187187
}
188188

@@ -231,7 +231,7 @@ public function testUrlKeyHasChangedInStoreviewContextWithoutPermanentRedirectio
231231

232232
$actual = $this->getActualResults($productFilter);
233233
foreach ($expected as $row) {
234-
$this->assertTrue(in_array($row, $actual));
234+
$this->assertContainsEquals($row, $actual);
235235
}
236236
}
237237
}

0 commit comments

Comments
 (0)