Skip to content

Commit 2297878

Browse files
committed
MC-40559 : Stabilize Integration Tests
- Fix Static tests
1 parent ef0a039 commit 2297878

File tree

5 files changed

+40
-8
lines changed

5 files changed

+40
-8
lines changed

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/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: 4 additions & 0 deletions
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

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

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

99
/**
10+
* Class LocaleQuantityProcessor
11+
*
1012
* @api
1113
* @since 100.0.2
1214
*/

dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,18 @@ public function testUnsubscribeSubscribe(): void
121121
$subscriber = $this->subscriberFactory->create();
122122
$this->assertSame($subscriber, $subscriber->loadByCustomerId(1));
123123
$this->assertEquals($subscriber, $subscriber->unsubscribe());
124-
$this->assertStringContainsString('You have been unsubscribed from the newsletter.', $this->getFilteredRawMessage($this->transportBuilder));
124+
$this->assertStringContainsString(
125+
'You have been unsubscribed from the newsletter.',
126+
$this->getFilteredRawMessage($this->transportBuilder)
127+
);
125128
$this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus());
126129
// Subscribe and verify
127130
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->subscribe('customer@example.com'));
128131
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus());
129-
$this->assertStringContainsString('You have been successfully subscribed to our newsletter.', $this->getFilteredRawMessage($this->transportBuilder));
132+
$this->assertStringContainsString(
133+
'You have been successfully subscribed to our newsletter.',
134+
$this->getFilteredRawMessage($this->transportBuilder)
135+
);
130136
}
131137

132138
/**
@@ -151,11 +157,17 @@ public function testUnsubscribeSubscribeByCustomerId(): void
151157
// Unsubscribe and verify
152158
$this->assertSame($subscriber, $subscriber->unsubscribeCustomerById(1));
153159
$this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus());
154-
$this->assertStringContainsString('You have been unsubscribed from the newsletter.', $this->getFilteredRawMessage($this->transportBuilder));
160+
$this->assertStringContainsString(
161+
'You have been unsubscribed from the newsletter.',
162+
$this->getFilteredRawMessage($this->transportBuilder)
163+
);
155164
// Subscribe and verify
156165
$this->assertSame($subscriber, $subscriber->subscribeCustomerById(1));
157166
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus());
158-
$this->assertStringContainsString('You have been successfully subscribed to our newsletter.', $this->getFilteredRawMessage($this->transportBuilder));
167+
$this->assertStringContainsString(
168+
'You have been successfully subscribed to our newsletter.',
169+
$this->getFilteredRawMessage($this->transportBuilder)
170+
);
159171
}
160172

161173
/**
@@ -172,7 +184,10 @@ public function testConfirm(): void
172184
$subscriber->subscribe($customerEmail);
173185
$subscriber->loadByEmail($customerEmail);
174186
$subscriber->confirm($subscriber->getSubscriberConfirmCode());
175-
$this->assertStringContainsString('You have been successfully subscribed to our newsletter.', $this->getFilteredRawMessage($this->transportBuilder));
187+
$this->assertStringContainsString(
188+
'You have been successfully subscribed to our newsletter.',
189+
$this->getFilteredRawMessage($this->transportBuilder)
190+
);
176191
}
177192

178193
/**

0 commit comments

Comments
 (0)