@@ -109,6 +109,7 @@ public function testAddRuleException()
109
109
{
110
110
$ this ->expectException (\InvalidArgumentException::class);
111
111
112
+ /** @noinspection PhpParamsInspection */
112
113
TestHelper::invoke ($ this ->inflector , 'addRule ' , new \stdClass , 'singular ' );
113
114
}
114
115
@@ -145,6 +146,11 @@ public function testAddCountableRule()
145
146
*/
146
147
public function testAddWordWithoutPlural ()
147
148
{
149
+ if (!$ this ->checkInflectorImplementation ($ this ->inflector ))
150
+ {
151
+ $ this ->markTestSkipped ('This test depends on the library \'s implementation ' );
152
+ }
153
+
148
154
$ this ->assertSame (
149
155
$ this ->inflector ,
150
156
$ this ->inflector ->addWord ('foo ' )
@@ -168,6 +174,11 @@ public function testAddWordWithoutPlural()
168
174
*/
169
175
public function testAddWordWithPlural ()
170
176
{
177
+ if (!$ this ->checkInflectorImplementation ($ this ->inflector ))
178
+ {
179
+ $ this ->markTestSkipped ('This test depends on the library \'s implementation ' );
180
+ }
181
+
171
182
$ this ->assertEquals (
172
183
$ this ->inflector ,
173
184
$ this ->inflector ->addWord ('bar ' , 'foo ' )
@@ -193,6 +204,11 @@ public function testAddWordWithPlural()
193
204
*/
194
205
public function testAddPluraliseRule ()
195
206
{
207
+ if (!$ this ->checkInflectorImplementation ($ this ->inflector ))
208
+ {
209
+ $ this ->markTestSkipped ('This test depends on the library \'s implementation ' );
210
+ }
211
+
196
212
$ this ->assertSame (
197
213
$ this ->inflector ->addPluraliseRule (['/^(custom)$/i ' => '\1izables ' ]),
198
214
$ this ->inflector ,
@@ -213,6 +229,11 @@ public function testAddPluraliseRule()
213
229
*/
214
230
public function testAddSingulariseRule ()
215
231
{
232
+ if (!$ this ->checkInflectorImplementation ($ this ->inflector ))
233
+ {
234
+ $ this ->markTestSkipped ('This test depends on the library \'s implementation ' );
235
+ }
236
+
216
237
$ this ->assertSame (
217
238
$ this ->inflector ->addSingulariseRule (['/^(inflec|contribu)tors$/i ' => '\1ta ' ]),
218
239
$ this ->inflector ,
@@ -272,6 +293,10 @@ public function testIsCountable(string $input, bool $expected)
272
293
*/
273
294
public function testIsPlural (string $ singular , string $ plural )
274
295
{
296
+ if ($ singular === 'bus ' && !$ this ->checkInflectorImplementation ($ this ->inflector )) {
297
+ $ this ->markTestSkipped ('"bus/buses" is not known to the new implementation ' );
298
+ }
299
+
275
300
$ this ->assertTrue (
276
301
$ this ->inflector ->isPlural ($ plural ),
277
302
"' $ plural' should be reported as plural "
@@ -296,6 +321,11 @@ public function testIsPlural(string $singular, string $plural)
296
321
*/
297
322
public function testIsSingular (string $ singular , string $ plural )
298
323
{
324
+ if ($ singular === 'bus ' && !$ this ->checkInflectorImplementation ($ this ->inflector ))
325
+ {
326
+ $ this ->markTestSkipped ('"bus/buses" is not known to the new implementation ' );
327
+ }
328
+
299
329
$ this ->assertTrue (
300
330
$ this ->inflector ->isSingular ($ singular ),
301
331
"' $ singular' should be reported as singular "
@@ -361,10 +391,22 @@ public function testToSingular(string $singular, string $plural)
361
391
*/
362
392
public function testToSingularAlreadySingular ()
363
393
{
394
+ if (!$ this ->checkInflectorImplementation ($ this ->inflector ))
395
+ {
396
+ $ this ->markTestSkipped ('"bus/buses" is not known to the new implementation ' );
397
+ }
398
+
364
399
$ this ->assertSame (
365
400
'bus ' ,
366
401
$ this ->inflector ->toSingular ('bus ' ),
367
402
"'bus' should not be singularised' "
368
403
);
369
404
}
405
+
406
+ private function checkInflectorImplementation (DoctrineInflector $ inflector ): bool
407
+ {
408
+ $ reflectionClass = new \ReflectionClass ($ inflector );
409
+
410
+ return $ reflectionClass ->hasProperty ('plural ' );
411
+ }
370
412
}
0 commit comments