@@ -81,14 +81,13 @@ public function testConfigUpdate(): void
81
81
$ this ->loggerMock ->expects ($ this ->exactly (2 ))
82
82
->method ('info ' )
83
83
// withConsecutive() alternative.
84
- ->willReturnCallback (function ($ args ) {
85
- static $ series = [
86
- 'Checking existence of encryption key ' ,
87
- sprintf ('Setting encryption key from %s ' , Environment::VARIABLE_CRYPT_KEY )
88
- ];
89
- $ expectedArgs = array_shift ($ series );
90
- $ this ->assertSame ($ expectedArgs , $ args );
91
- });
84
+ ->with (self ::callback (function (string $ message ) {
85
+ static $ i = 0 ;
86
+ return match (++$ i ) {
87
+ 1 => $ message === 'Checking existence of encryption key ' ,
88
+ 2 => $ message === sprintf ('Setting encryption key from %s ' , Environment::VARIABLE_CRYPT_KEY )
89
+ };
90
+ }));
92
91
$ this ->configWriterMock ->expects ($ this ->once ())
93
92
->method ('update ' )
94
93
->with (['crypt ' => ['key ' => 'TWFnZW50byBSb3g= ' ]]);
@@ -117,14 +116,13 @@ public function testConfigUpdateWithError(): void
117
116
$ this ->loggerMock ->expects ($ this ->exactly (2 ))
118
117
->method ('info ' )
119
118
// withConsecutive() alternative.
120
- ->willReturnCallback (function ($ args ) {
121
- static $ series = [
122
- 'Checking existence of encryption key ' ,
123
- sprintf ('Setting encryption key from %s ' , Environment::VARIABLE_CRYPT_KEY )
124
- ];
125
- $ expectedArgs = array_shift ($ series );
126
- $ this ->assertSame ($ expectedArgs , $ args );
127
- });
119
+ ->with (self ::callback (function (string $ message ) {
120
+ static $ i = 0 ;
121
+ return match (++$ i ) {
122
+ 1 => $ message === 'Checking existence of encryption key ' ,
123
+ 2 => $ message === sprintf ('Setting encryption key from %s ' , Environment::VARIABLE_CRYPT_KEY ),
124
+ };
125
+ }));
128
126
$ this ->configWriterMock ->expects ($ this ->once ())
129
127
->method ('update ' )
130
128
->with (['crypt ' => ['key ' => 'TWFnZW50byBSb3g= ' ]])
0 commit comments