@@ -67,9 +67,9 @@ protected function setUp()
67
67
public function testExecuteWithoutAmqp ()
68
68
{
69
69
$ config = ['some config ' ];
70
- $ this ->environmentMock ->expects ($ this ->once ())
70
+ $ this ->environmentMock ->expects ($ this ->any ())
71
71
->method ('getRelationship ' )
72
- ->with (' mq ' )
72
+ ->with ($ this -> anything () )
73
73
->willReturn ([]);
74
74
$ this ->configReaderMock ->expects ($ this ->once ())
75
75
->method ('read ' )
@@ -88,32 +88,18 @@ public function testExecuteWithoutAmqp()
88
88
* @return void
89
89
* @dataProvider executeAddUpdateDataProvider
90
90
*/
91
- public function testExecuteAddUpdate (array $ config )
91
+ public function testExecuteAddUpdate (array $ config, array $ amqpConfig , array $ resultConfig )
92
92
{
93
- $ amqpConfig = [[
94
- 'host ' => 'localhost ' ,
95
- 'port ' => '777 ' ,
96
- 'username ' => 'login ' ,
97
- 'password ' => 'pswd '
98
- ]];
99
- $ resultConfig = [
100
- 'some config ' ,
101
- 'queue ' => [
102
- 'amqp ' => [
103
- 'host ' => 'localhost ' ,
104
- 'port ' => '777 ' ,
105
- 'user ' => 'login ' ,
106
- 'password ' => 'pswd ' ,
107
- 'virtualhost ' => '/ ' ,
108
- 'ssl ' => '' ,
109
- ]
110
- ],
111
- ];
112
-
113
- $ this ->environmentMock ->expects ($ this ->once ())
93
+ $ this ->environmentMock ->expects ($ this ->exactly (2 ))
114
94
->method ('getRelationship ' )
115
- ->with ('mq ' )
116
- ->willReturn ($ amqpConfig );
95
+ ->withConsecutive (
96
+ ['rabbitmq ' ],
97
+ ['mq ' ]
98
+ )
99
+ ->willReturnOnConsecutiveCalls (
100
+ [],
101
+ $ amqpConfig
102
+ );
117
103
$ this ->configReaderMock ->expects ($ this ->once ())
118
104
->method ('read ' )
119
105
->willReturn ($ config );
@@ -133,20 +119,86 @@ public function testExecuteAddUpdate(array $config)
133
119
public function executeAddUpdateDataProvider (): array
134
120
{
135
121
return [
136
- [['some config ' ]],
137
- [[
138
- 'some config ' ,
139
- 'queue ' => [
140
- 'amqp ' => [
141
- 'host ' => 'some-host ' ,
142
- 'port ' => '888 ' ,
143
- 'user ' => 'mylogin ' ,
144
- 'password ' => 'mysqwwd ' ,
145
- 'virtualhost ' => 'virtualhost ' ,
146
- 'ssl ' => '1 ' ,
147
- ]
122
+ [
123
+ ['some config ' ],
124
+ [[
125
+ 'host ' => 'localhost ' ,
126
+ 'port ' => '777 ' ,
127
+ 'username ' => 'login ' ,
128
+ 'password ' => 'pswd ' ,
129
+ 'vhost ' => 'virtualhost '
130
+ ]],
131
+ [
132
+ 'some config ' ,
133
+ 'queue ' => [
134
+ 'amqp ' => [
135
+ 'host ' => 'localhost ' ,
136
+ 'port ' => '777 ' ,
137
+ 'user ' => 'login ' ,
138
+ 'password ' => 'pswd ' ,
139
+ 'virtualhost ' => 'virtualhost ' ,
140
+ 'ssl ' => '' ,
141
+ ]
142
+ ],
143
+ ]
144
+ ],
145
+ [
146
+ ['some config ' ],
147
+ [[
148
+ 'host ' => 'localhost ' ,
149
+ 'port ' => '777 ' ,
150
+ 'username ' => 'login ' ,
151
+ 'password ' => 'pswd ' ,
152
+ ]],
153
+ [
154
+ 'some config ' ,
155
+ 'queue ' => [
156
+ 'amqp ' => [
157
+ 'host ' => 'localhost ' ,
158
+ 'port ' => '777 ' ,
159
+ 'user ' => 'login ' ,
160
+ 'password ' => 'pswd ' ,
161
+ 'virtualhost ' => '/ ' ,
162
+ 'ssl ' => '' ,
163
+ ]
164
+ ],
165
+ ]
166
+ ],
167
+ [
168
+ [
169
+ 'some config ' ,
170
+ 'queue ' => [
171
+ 'amqp ' => [
172
+ 'host ' => 'some-host ' ,
173
+ 'port ' => '888 ' ,
174
+ 'user ' => 'mylogin ' ,
175
+ 'password ' => 'mysqwwd ' ,
176
+ 'virtualhost ' => 'virtualhost ' ,
177
+ 'ssl ' => '1 ' ,
178
+ ]
179
+ ],
148
180
],
149
- ]]
181
+ [[
182
+ 'host ' => 'localhost ' ,
183
+ 'port ' => '777 ' ,
184
+ 'username ' => 'login ' ,
185
+ 'password ' => 'pswd ' ,
186
+ 'vhost ' => 'virtualhost '
187
+ ]],
188
+ [
189
+ 'some config ' ,
190
+ 'queue ' => [
191
+ 'amqp ' => [
192
+ 'host ' => 'localhost ' ,
193
+ 'port ' => '777 ' ,
194
+ 'user ' => 'login ' ,
195
+ 'password ' => 'pswd ' ,
196
+ 'virtualhost ' => 'virtualhost ' ,
197
+ 'ssl ' => '' ,
198
+ ]
199
+ ],
200
+ ]
201
+ ]
150
202
];
151
203
}
152
204
@@ -158,9 +210,9 @@ public function executeAddUpdateDataProvider(): array
158
210
*/
159
211
public function testExecuteRemoveAmqp (array $ config , array $ expectedConfig )
160
212
{
161
- $ this ->environmentMock ->expects ($ this ->once ())
213
+ $ this ->environmentMock ->expects ($ this ->any ())
162
214
->method ('getRelationship ' )
163
- ->with (' mq ' )
215
+ ->with ($ this -> anything () )
164
216
->willReturn ([]);
165
217
$ this ->configReaderMock ->expects ($ this ->once ())
166
218
->method ('read ' )
0 commit comments