Skip to content

Commit 8c8b9cf

Browse files
author
Bartosz Kubicki
committed
Possible fix for integration test
1 parent 7e97fb4 commit 8c8b9cf

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

dev/tests/integration/testsuite/Magento/Framework/MessageQueue/TopologyTest.php

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Framework\MessageQueue;
710

11+
use Magento\TestFramework\Helper\Amqp;
812
use Magento\TestFramework\Helper\Bootstrap;
9-
use Magento\TestFramework\MessageQueue\PreconditionFailedException;
13+
use PHPUnit\Framework\TestCase;
1014

1115
/**
1216
* @see dev/tests/integration/_files/Magento/TestModuleMessageQueueConfiguration
1317
* @see dev/tests/integration/_files/Magento/TestModuleMessageQueueConfigOverride
1418
*/
15-
class TopologyTest extends \PHPUnit\Framework\TestCase
19+
class TopologyTest extends TestCase
1620
{
1721
/**
1822
* List of declared exchanges.
@@ -22,13 +26,16 @@ class TopologyTest extends \PHPUnit\Framework\TestCase
2226
private $declaredExchanges;
2327

2428
/**
25-
* @var \Magento\TestFramework\Helper\Amqp
29+
* @var Amqp
2630
*/
2731
private $helper;
2832

33+
/**
34+
* @return void
35+
*/
2936
protected function setUp(): void
3037
{
31-
$this->helper = Bootstrap::getObjectManager()->create(\Magento\TestFramework\Helper\Amqp::class);
38+
$this->helper = Bootstrap::getObjectManager()->create(Amqp::class);
3239

3340
if (!$this->helper->isAvailable()) {
3441
$this->fail('This test relies on RabbitMQ Management Plugin.');
@@ -42,24 +49,28 @@ protected function setUp(): void
4249
* @param array $expectedConfig
4350
* @param array $bindingConfig
4451
*/
45-
public function testTopologyInstallation(array $expectedConfig, array $bindingConfig)
52+
public function testTopologyInstallation(array $expectedConfig, array $bindingConfig): void
4653
{
4754
$name = $expectedConfig['name'];
4855
$this->assertArrayHasKey($name, $this->declaredExchanges);
49-
unset($this->declaredExchanges[$name]['message_stats']);
50-
unset($this->declaredExchanges[$name]['user_who_performed_action']);
51-
$this->assertSame(
56+
unset(
57+
$this->declaredExchanges[$name]['message_stats'],
58+
$this->declaredExchanges[$name]['user_who_performed_action']
59+
);
60+
61+
$this->assertEquals(
5262
$expectedConfig,
5363
$this->declaredExchanges[$name],
5464
'Invalid exchange configuration: ' . $name
5565
);
5666

5767
$bindings = $this->helper->getExchangeBindings($name);
58-
$bindings = array_map(function ($value) {
68+
$bindings = array_map(static function ($value) {
5969
unset($value['properties_key']);
6070
return $value;
6171
}, $bindings);
62-
$this->assertSame(
72+
73+
$this->assertEquals(
6374
$bindingConfig,
6475
$bindings,
6576
'Invalid exchange bindings configuration: ' . $name
@@ -70,7 +81,7 @@ public function testTopologyInstallation(array $expectedConfig, array $bindingCo
7081
* @return array
7182
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
7283
*/
73-
public function exchangeDataProvider()
84+
public function exchangeDataProvider(): array
7485
{
7586
return [
7687
'magento-topic-based-exchange1' => [

0 commit comments

Comments
 (0)