3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
7
+ declare (strict_types=1 );
8
+
6
9
namespace Magento \Framework \MessageQueue ;
7
10
11
+ use Magento \TestFramework \Helper \Amqp ;
8
12
use Magento \TestFramework \Helper \Bootstrap ;
9
- use Magento \ TestFramework \ MessageQueue \ PreconditionFailedException ;
13
+ use PHPUnit \ Framework \ TestCase ;
10
14
11
15
/**
12
16
* @see dev/tests/integration/_files/Magento/TestModuleMessageQueueConfiguration
13
17
* @see dev/tests/integration/_files/Magento/TestModuleMessageQueueConfigOverride
14
18
*/
15
- class TopologyTest extends \ PHPUnit \ Framework \ TestCase
19
+ class TopologyTest extends TestCase
16
20
{
17
21
/**
18
22
* List of declared exchanges.
@@ -22,13 +26,16 @@ class TopologyTest extends \PHPUnit\Framework\TestCase
22
26
private $ declaredExchanges ;
23
27
24
28
/**
25
- * @var \Magento\TestFramework\Helper\ Amqp
29
+ * @var Amqp
26
30
*/
27
31
private $ helper ;
28
32
33
+ /**
34
+ * @return void
35
+ */
29
36
protected function setUp (): void
30
37
{
31
- $ this ->helper = Bootstrap::getObjectManager ()->create (\ Magento \ TestFramework \ Helper \ Amqp::class);
38
+ $ this ->helper = Bootstrap::getObjectManager ()->create (Amqp::class);
32
39
33
40
if (!$ this ->helper ->isAvailable ()) {
34
41
$ this ->fail ('This test relies on RabbitMQ Management Plugin. ' );
@@ -42,24 +49,28 @@ protected function setUp(): void
42
49
* @param array $expectedConfig
43
50
* @param array $bindingConfig
44
51
*/
45
- public function testTopologyInstallation (array $ expectedConfig , array $ bindingConfig )
52
+ public function testTopologyInstallation (array $ expectedConfig , array $ bindingConfig ): void
46
53
{
47
54
$ name = $ expectedConfig ['name ' ];
48
55
$ 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 (
52
62
$ expectedConfig ,
53
63
$ this ->declaredExchanges [$ name ],
54
64
'Invalid exchange configuration: ' . $ name
55
65
);
56
66
57
67
$ bindings = $ this ->helper ->getExchangeBindings ($ name );
58
- $ bindings = array_map (function ($ value ) {
68
+ $ bindings = array_map (static function ($ value ) {
59
69
unset($ value ['properties_key ' ]);
60
70
return $ value ;
61
71
}, $ bindings );
62
- $ this ->assertSame (
72
+
73
+ $ this ->assertEquals (
63
74
$ bindingConfig ,
64
75
$ bindings ,
65
76
'Invalid exchange bindings configuration: ' . $ name
@@ -70,7 +81,7 @@ public function testTopologyInstallation(array $expectedConfig, array $bindingCo
70
81
* @return array
71
82
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
72
83
*/
73
- public function exchangeDataProvider ()
84
+ public function exchangeDataProvider (): array
74
85
{
75
86
return [
76
87
'magento-topic-based-exchange1 ' => [
0 commit comments