Skip to content

Commit 208fbc7

Browse files
committed
MC-33908: Fix Integration tests for framework and categoryPermission
1 parent 86677f6 commit 208fbc7

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

dev/tests/integration/testsuite/Magento/Framework/MessageQueue/UseCase/MixSyncAndAsyncSingleQueueTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testMixSyncAndAsyncSingleQueue()
4242

4343
// Publish synchronous message to the same queue
4444
$input = 'Input value';
45-
$response = $this->publisher->publish('sync.topic.for.mixed.sync.and.async.queue', [$input]);
45+
$response = $this->publisher->publish('sync.topic.for.mixed.sync.and.async.queue', $input);
4646
$this->assertEquals($input . ' processed by RPC handler', $response);
4747

4848
$this->waitForAsynchronousResult(count($this->messages), $this->logFilePath);

dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ChangelogTest extends \PHPUnit\Framework\TestCase
1818
protected $objectManager;
1919

2020
/**
21-
* @var \Magento\Framework\App\ResourceConnection
21+
* @var ResourceConnection
2222
*/
2323
protected $resource;
2424

@@ -30,7 +30,7 @@ class ChangelogTest extends \PHPUnit\Framework\TestCase
3030
protected $connection;
3131

3232
/**
33-
* @var \Magento\Framework\Mview\View\Changelog
33+
* @var Changelog
3434
*/
3535
protected $model;
3636

@@ -40,11 +40,11 @@ class ChangelogTest extends \PHPUnit\Framework\TestCase
4040
protected function setUp(): void
4141
{
4242
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
43-
$this->resource = $this->objectManager->get(\Magento\Framework\App\ResourceConnection::class);
43+
$this->resource = $this->objectManager->get(ResourceConnection::class);
4444
$this->connection = $this->resource->getConnection();
4545

4646
$this->model = $this->objectManager->create(
47-
\Magento\Framework\Mview\View\Changelog::class,
47+
Changelog::class,
4848
['resource' => $this->resource]
4949
);
5050
$this->model->setViewId('test_view_id_1');
@@ -53,6 +53,7 @@ protected function setUp(): void
5353

5454
/**
5555
* @return void
56+
* @throws ChangelogTableNotExistsException
5657
*/
5758
protected function tearDown(): void
5859
{
@@ -63,12 +64,13 @@ protected function tearDown(): void
6364
* Test for create() and drop() methods
6465
*
6566
* @return void
67+
* @throws ChangelogTableNotExistsException
6668
*/
6769
public function testCreateAndDrop()
6870
{
69-
/** @var \Magento\Framework\Mview\View\Changelog $model */
71+
/** @var Changelog $model */
7072
$model = $this->objectManager->create(
71-
\Magento\Framework\Mview\View\Changelog::class,
73+
Changelog::class,
7274
['resource' => $this->resource]
7375
);
7476
$model->setViewId('test_view_id_2');
@@ -84,11 +86,12 @@ public function testCreateAndDrop()
8486
* Test for getVersion() method
8587
*
8688
* @return void
89+
* @throws \Exception
8790
*/
8891
public function testGetVersion()
8992
{
9093
$model = $this->objectManager->create(
91-
\Magento\Framework\Mview\View\Changelog::class,
94+
Changelog::class,
9295
['resource' => $this->resource]
9396
);
9497
$model->setViewId('test_view_id_2');
@@ -104,6 +107,8 @@ public function testGetVersion()
104107
* Test for clear() method
105108
*
106109
* @return void
110+
* @throws ChangelogTableNotExistsException
111+
* @throws \Magento\Framework\Exception\RuntimeException
107112
*/
108113
public function testClear()
109114
{
@@ -120,6 +125,8 @@ public function testClear()
120125
* Test for getList() method
121126
*
122127
* @return void
128+
* @throws ChangelogTableNotExistsException
129+
* @throws \Magento\Framework\Exception\RuntimeException
123130
*/
124131
public function testGetList()
125132
{

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Newsletter\Model;
99

10+
use Laminas\Mail\Headers;
1011
use Magento\Customer\Api\CustomerRepositoryInterface;
1112
use Magento\Framework\ObjectManagerInterface;
1213
use Magento\TestFramework\Helper\Bootstrap;
@@ -89,18 +90,27 @@ public function testUnsubscribeSubscribe(): void
8990
$this->assertEquals($subscriber, $subscriber->unsubscribe());
9091
$this->assertStringContainsString(
9192
'You have been unsubscribed from the newsletter.',
92-
$this->transportBuilder->getSentMessage()->getRawMessage()
93+
$this->getFilteredRawMessage($this->transportBuilder)
9394
);
9495
$this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus());
9596
// Subscribe and verify
9697
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->subscribe('customer@example.com'));
9798
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus());
9899
$this->assertStringContainsString(
99100
'You have been successfully subscribed to our newsletter.',
100-
$this->transportBuilder->getSentMessage()->getRawMessage()
101+
$this->getFilteredRawMessage($this->transportBuilder)
101102
);
102103
}
103104

105+
/**
106+
* @param TransportBuilderMock $transportBuilderMock
107+
* @return string
108+
*/
109+
private function getFilteredRawMessage(TransportBuilderMock $transportBuilderMock): string
110+
{
111+
return str_replace('=' . Headers::EOL, '', $transportBuilderMock->getSentMessage()->getRawMessage());
112+
}
113+
104114
/**
105115
* @magentoDataFixture Magento/Newsletter/_files/subscribers.php
106116
*
@@ -116,14 +126,14 @@ public function testUnsubscribeSubscribeByCustomerId(): void
116126
$this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus());
117127
$this->assertStringContainsString(
118128
'You have been unsubscribed from the newsletter.',
119-
$this->transportBuilder->getSentMessage()->getRawMessage()
129+
$this->getFilteredRawMessage($this->transportBuilder)
120130
);
121131
// Subscribe and verify
122132
$this->assertSame($subscriber, $subscriber->subscribeCustomerById(1));
123133
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus());
124134
$this->assertStringContainsString(
125135
'You have been successfully subscribed to our newsletter.',
126-
$this->transportBuilder->getSentMessage()->getRawMessage()
136+
$this->getFilteredRawMessage($this->transportBuilder)
127137
);
128138
}
129139

@@ -143,7 +153,7 @@ public function testConfirm(): void
143153
$subscriber->confirm($subscriber->getSubscriberConfirmCode());
144154
$this->assertStringContainsString(
145155
'You have been successfully subscribed to our newsletter.',
146-
$this->transportBuilder->getSentMessage()->getRawMessage()
156+
$this->getFilteredRawMessage($this->transportBuilder)
147157
);
148158
}
149159

@@ -152,6 +162,8 @@ public function testConfirm(): void
152162
* @magentoDataFixture Magento/Newsletter/_files/newsletter_unconfirmed_customer.php
153163
*
154164
* @return void
165+
* @throws \Magento\Framework\Exception\LocalizedException
166+
* @throws \Magento\Framework\Exception\NoSuchEntityException
155167
*/
156168
public function testSubscribeUnconfirmedCustomerWithSubscription(): void
157169
{

dev/tests/integration/testsuite/Magento/Store/App/FrontController/Plugin/RequestPreprocessorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public function testHttpsPassSecureLoginPost()
9090
* @param array $config
9191
* @param string $requestUrl
9292
* @param string $redirectUrl
93+
* @magentoAppArea frontend
9394
* @dataProvider autoRedirectToBaseURLDataProvider
9495
*/
9596
public function testAutoRedirectToBaseURL(array $config, string $requestUrl, string $redirectUrl)

lib/internal/Magento/Framework/Mview/View/Changelog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function getVersion()
180180
}
181181
$select = $this->connection->select()->from($changelogTableName)->order('version_id DESC')->limit(1);
182182
$row = $this->connection->fetchRow($select);
183-
if ($row === false) {
183+
if (!$row) {
184184
return 0;
185185
} else {
186186
if (is_array($row) && array_key_exists('version_id', $row)) {

0 commit comments

Comments
 (0)