Skip to content

Commit 67c535b

Browse files
committed
MC-34039: Merge 2.4-develop into 2.4-develop-php74
-- fix merge conflict
1 parent f2b2f81 commit 67c535b

File tree

2 files changed

+29
-6
lines changed
  • app/code/Magento/GroupedImportExport/Test/Unit/Model/Import/Product/Type/Grouped
  • dev/tests/integration/testsuite/Magento/Newsletter/Model

2 files changed

+29
-6
lines changed

app/code/Magento/GroupedImportExport/Test/Unit/Model/Import/Product/Type/Grouped/LinksTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,24 @@ public function testSaveLinksDataWithProductsAttrs($linksData)
108108
$linksData['attr_product_ids'] = [12 => true, 16 => true];
109109
$linksData['position'] = [4 => 6];
110110
$linksData['qty'] = [9 => 3];
111+
$attributes = [
112+
['id' => 1, 'code' => 'position', 'type' => 'int'],
113+
['id' => 2, 'code' => 'qty', 'type' => 'decimal'],
114+
];
111115
$this->processBehaviorGetter('append');
112116
$select = $this->createMock(Select::class);
113117
$this->connection->expects($this->any())->method('select')->willReturn($select);
114118
$select->expects($this->any())->method('from')->willReturnSelf();
115119
$select->expects($this->any())->method('where')->willReturnSelf();
116-
$this->connection->expects($this->once())->method('fetchAll')->with($select)->willReturn([]);
120+
$this->connection->expects($this->once())->method('fetchAll')->with($select)->willReturn($attributes);
117121
$this->connection->expects($this->once())->method('fetchPairs')->with($select)->willReturn(
118122
[]
119123
);
120124
$this->connection->expects($this->exactly(4))->method('insertOnDuplicate');
125+
$this->link->expects($this->exactly(2))->method('getAttributeTypeTable')->willReturn(
126+
'table_name'
127+
);
128+
121129
$this->links->saveLinksData($linksData);
122130
}
123131

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
namespace Magento\Newsletter\Model;
99

1010
use Magento\Customer\Api\CustomerRepositoryInterface;
11+
use Magento\Framework\Exception\LocalizedException;
12+
use Magento\Framework\Exception\NoSuchEntityException;
1113
use Magento\Framework\ObjectManagerInterface;
1214
use Magento\TestFramework\Helper\Bootstrap;
1315
use Magento\TestFramework\Mail\Template\TransportBuilderMock;
@@ -89,18 +91,27 @@ public function testUnsubscribeSubscribe(): void
8991
$this->assertEquals($subscriber, $subscriber->unsubscribe());
9092
$this->assertStringContainsString(
9193
'You have been unsubscribed from the newsletter.',
92-
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
94+
$this->getFilteredRawMessage($this->transportBuilder)
9395
);
9496
$this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus());
9597
// Subscribe and verify
9698
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->subscribe('customer@example.com'));
9799
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus());
98100
$this->assertStringContainsString(
99101
'You have been successfully subscribed to our newsletter.',
100-
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
102+
$this->getFilteredRawMessage($this->transportBuilder)
101103
);
102104
}
103105

106+
/**
107+
* @param TransportBuilderMock $transportBuilderMock
108+
* @return string
109+
*/
110+
private function getFilteredRawMessage(TransportBuilderMock $transportBuilderMock): string
111+
{
112+
return $transportBuilderMock->getSentMessage()->getBody()->getParts()[0]->getRawContent();
113+
}
114+
104115
/**
105116
* @magentoDataFixture Magento/Newsletter/_files/subscribers.php
106117
*
@@ -116,14 +127,14 @@ public function testUnsubscribeSubscribeByCustomerId(): void
116127
$this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus());
117128
$this->assertStringContainsString(
118129
'You have been unsubscribed from the newsletter.',
119-
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
130+
$this->getFilteredRawMessage($this->transportBuilder)
120131
);
121132
// Subscribe and verify
122133
$this->assertSame($subscriber, $subscriber->subscribeCustomerById(1));
123134
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus());
124135
$this->assertStringContainsString(
125136
'You have been successfully subscribed to our newsletter.',
126-
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
137+
$this->getFilteredRawMessage($this->transportBuilder)
127138
);
128139
}
129140

@@ -143,7 +154,7 @@ public function testConfirm(): void
143154
$subscriber->confirm($subscriber->getSubscriberConfirmCode());
144155
$this->assertStringContainsString(
145156
'You have been successfully subscribed to our newsletter.',
146-
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
157+
$this->getFilteredRawMessage($this->transportBuilder)
147158
);
148159
}
149160

@@ -152,6 +163,8 @@ public function testConfirm(): void
152163
* @magentoDataFixture Magento/Newsletter/_files/newsletter_unconfirmed_customer.php
153164
*
154165
* @return void
166+
* @throws LocalizedException
167+
* @throws NoSuchEntityException
155168
*/
156169
public function testSubscribeUnconfirmedCustomerWithSubscription(): void
157170
{
@@ -166,6 +179,8 @@ public function testSubscribeUnconfirmedCustomerWithSubscription(): void
166179
* @magentoDataFixture Magento/Customer/_files/unconfirmed_customer.php
167180
*
168181
* @return void
182+
* @throws LocalizedException
183+
* @throws NoSuchEntityException
169184
*/
170185
public function testSubscribeUnconfirmedCustomerWithoutSubscription(): void
171186
{

0 commit comments

Comments
 (0)