@@ -46,7 +46,7 @@ public function testMbStrPad(string $expectedResult, string $string, int $length
46
46
public function testMbStrPadInvalidArguments (string $ expectedError , string $ string , int $ length , string $ padString , int $ padType , string $ encoding = null ): void
47
47
{
48
48
$ this ->expectException (\ValueError::class);
49
- $ this ->expectErrorMessage ($ expectedError );
49
+ $ this ->expectExceptionMessage ($ expectedError );
50
50
51
51
mb_str_pad ($ string , $ length , $ padString , $ padType , $ encoding );
52
52
}
@@ -161,7 +161,7 @@ public static function jsonDataProvider(): iterable
161
161
public function testJsonValidateInvalidOptionsProvided (int $ depth , int $ flags , string $ expectedError )
162
162
{
163
163
$ this ->expectException (\ValueError::class);
164
- $ this ->expectErrorMessage ($ expectedError );
164
+ $ this ->expectExceptionMessage ($ expectedError );
165
165
json_validate ('{} ' , $ depth , $ flags );
166
166
}
167
167
@@ -202,4 +202,66 @@ public function testDateTimeExceptionClassesExist()
202
202
$ this ->assertTrue (class_exists (\DateMalformedIntervalStringException::class));
203
203
$ this ->assertTrue (class_exists (\DateMalformedPeriodStringException::class));
204
204
}
205
+
206
+ /**
207
+ * @dataProvider strIncrementProvider
208
+ */
209
+ public function testStrIncrement (string $ result , string $ string )
210
+ {
211
+ $ this ->assertSame ($ result , str_increment ($ string ));
212
+ }
213
+
214
+ /**
215
+ * @dataProvider strIncrementProvider
216
+ */
217
+ public function testStrDecrements (string $ string , string $ result )
218
+ {
219
+ $ this ->assertSame ($ result , str_decrement ($ string ));
220
+ }
221
+
222
+ public static function strIncrementProvider (): iterable
223
+ {
224
+ yield ['ABD ' , 'ABC ' ];
225
+ yield ['EB ' , 'EA ' ];
226
+ yield ['AAA ' , 'ZZ ' ];
227
+ yield ['AAA2 ' , 'AAA1 ' ];
228
+ }
229
+
230
+ /**
231
+ * @dataProvider strInvalidIncrementProvider
232
+ */
233
+ public function testInvalidStrIncrements (string $ errorMessage , string $ string )
234
+ {
235
+ $ this ->expectException (\ValueError::class);
236
+ $ this ->expectExceptionMessage ($ errorMessage );
237
+
238
+ str_increment ($ string );
239
+ }
240
+
241
+
242
+ public static function strInvalidIncrementProvider (): iterable
243
+ {
244
+ yield ['str_increment(): Argument #1 ($string) cannot be empty ' , "" ];
245
+ yield ['str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters ' , '我喜歡雞肉 ' ];
246
+ yield ['str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters ' , '書左 ' ];
247
+ }
248
+
249
+
250
+ /**
251
+ * @dataProvider strInvalidDecrementProvider
252
+ */
253
+ public function testInvalidStrDecrements (string $ errorMessage , string $ string )
254
+ {
255
+ $ this ->expectException (\ValueError::class);
256
+ $ this ->expectExceptionMessage ($ errorMessage );
257
+
258
+ str_decrement ($ string );
259
+ }
260
+
261
+ public static function strInvalidDecrementProvider (): iterable
262
+ {
263
+ yield ['str_decrement(): Argument #1 ($string) cannot be empty ' , '' ];
264
+ yield ['str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters ' , '我喜歡雞肉 ' ];
265
+ yield ['str_decrement(): Argument #1 ($string) "A" is out of decrement range ' , 'A ' ];
266
+ }
205
267
}
0 commit comments