@@ -72,33 +72,39 @@ protected function setUp()
72
72
73
73
public function testValidate (): void
74
74
{
75
- $ service1 = $ this ->createMock (ServiceInterface::class);
76
- $ service1 ->expects ($ this ->once ())
75
+ $ serviceRmq = $ this ->createMock (ServiceInterface::class);
76
+ $ serviceRmq ->expects ($ this ->once ())
77
77
->method ('getVersion ' )
78
78
->willReturn ('0 ' );
79
- $ service2 = $ this ->createMock (ServiceInterface::class);
80
- $ service2 ->expects ($ this ->once ())
79
+ $ serviceRedis = $ this ->createMock (ServiceInterface::class);
80
+ $ serviceRedis ->expects ($ this ->once ())
81
81
->method ('getVersion ' )
82
82
->willReturn ('3.2 ' );
83
- $ service3 = $ this ->createMock (ServiceInterface::class);
84
- $ service3 ->expects ($ this ->once ())
83
+ $ serviceDB = $ this ->createMock (ServiceInterface::class);
84
+ $ serviceDB ->expects ($ this ->once ())
85
85
->method ('getVersion ' )
86
86
->willReturn ('10.2 ' );
87
- $ this ->serviceFactory ->expects ($ this ->exactly (3 ))
87
+ $ serviceES = $ this ->createMock (ServiceInterface::class);
88
+ $ serviceES ->expects ($ this ->once ())
89
+ ->method ('getVersion ' )
90
+ ->willReturn ('7.7 ' );
91
+ $ this ->serviceFactory ->expects ($ this ->exactly (4 ))
88
92
->method ('create ' )
89
- ->willReturnOnConsecutiveCalls ($ service1 , $ service2 , $ service3 );
90
- $ this ->loggerMock ->expects ($ this ->exactly (3 ))
93
+ ->willReturnOnConsecutiveCalls ($ serviceRmq , $ serviceRedis , $ serviceDB , $ serviceES );
94
+ $ this ->loggerMock ->expects ($ this ->exactly (4 ))
91
95
->method ('info ' )
92
96
->withConsecutive (
93
97
['Version of service \'rabbitmq \' is not detected ' , []],
94
98
['Version of service \'redis \' is 3.2 ' , []],
95
- ['Version of service \'mysql \' is 10.2 ' , []]
99
+ ['Version of service \'mysql \' is 10.2 ' , []],
100
+ ['Version of service \'elasticsearch \' is 7.7 ' , []]
96
101
);
97
- $ this ->serviceVersionValidatorMock ->expects ($ this ->exactly (2 ))
102
+ $ this ->serviceVersionValidatorMock ->expects ($ this ->exactly (3 ))
98
103
->method ('validateService ' )
99
104
->withConsecutive (
100
105
[ServiceInterface::NAME_REDIS , '3.2 ' ],
101
- [ServiceInterface::NAME_DB , '10.2 ' ]
106
+ [ServiceInterface::NAME_DB , '10.2 ' ],
107
+ [ServiceInterface::NAME_ELASTICSEARCH , '7.7 ' ]
102
108
)
103
109
->willReturn ('' );
104
110
$ this ->resultFactoryMock ->expects ($ this ->once ())
@@ -109,7 +115,7 @@ public function testValidate(): void
109
115
110
116
public function testValidateWithErrors (): void
111
117
{
112
- $ errorMessages = ['error message 1 ' , 'error message 2 ' , 'error message 3 ' ];
118
+ $ errorMessages = ['error message 1 ' , 'error message 2 ' , 'error message 3 ' , ' error message 4 ' ];
113
119
$ service1 = $ this ->createMock (ServiceInterface::class);
114
120
$ service1 ->expects ($ this ->once ())
115
121
->method ('getVersion ' )
@@ -122,15 +128,20 @@ public function testValidateWithErrors(): void
122
128
$ service3 ->expects ($ this ->once ())
123
129
->method ('getVersion ' )
124
130
->willReturn ('5.7 ' );
125
- $ this ->serviceFactory ->expects ($ this ->exactly (3 ))
131
+ $ service4 = $ this ->createMock (ServiceInterface::class);
132
+ $ service4 ->expects ($ this ->once ())
133
+ ->method ('getVersion ' )
134
+ ->willReturn ('7.7 ' );
135
+ $ this ->serviceFactory ->expects ($ this ->exactly (4 ))
126
136
->method ('create ' )
127
- ->willReturnOnConsecutiveCalls ($ service1 , $ service2 , $ service3 );
128
- $ this ->serviceVersionValidatorMock ->expects ($ this ->exactly (3 ))
137
+ ->willReturnOnConsecutiveCalls ($ service1 , $ service2 , $ service3, $ service4 );
138
+ $ this ->serviceVersionValidatorMock ->expects ($ this ->exactly (4 ))
129
139
->method ('validateService ' )
130
140
->withConsecutive (
131
141
[ServiceInterface::NAME_RABBITMQ , '1.5 ' ],
132
142
[ServiceInterface::NAME_REDIS , '2.2 ' ],
133
- [ServiceInterface::NAME_DB , '5.7 ' ]
143
+ [ServiceInterface::NAME_DB , '5.7 ' ],
144
+ [ServiceInterface::NAME_ELASTICSEARCH , '7.7 ' ]
134
145
)
135
146
->willReturnOnConsecutiveCalls (...$ errorMessages );
136
147
$ this ->resultFactoryMock ->expects ($ this ->once ())
0 commit comments