Skip to content

Commit fecdb4f

Browse files
committed
Util/Common: move dataProviders below the corresponding tests
1 parent eafca39 commit fecdb4f

File tree

1 file changed

+74
-74
lines changed

1 file changed

+74
-74
lines changed

tests/Core/Util/Common/IsCamelCapsTest.php

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,23 @@ final class IsCamelCapsTest extends TestCase
2121
{
2222

2323

24+
/**
25+
* Test valid public function/method names.
26+
*
27+
* @param string $name The tested name.
28+
* @param bool $strict Value of the $strict flag.
29+
*
30+
* @dataProvider dataValidNotClassFormatPublic
31+
*
32+
* @return void
33+
*/
34+
public function testValidNotClassFormatPublic($name, $strict)
35+
{
36+
$this->assertTrue(Common::isCamelCaps($name, false, true, $strict));
37+
38+
}//end testValidNotClassFormatPublic()
39+
40+
2441
/**
2542
* Data provider.
2643
*
@@ -49,20 +66,19 @@ public static function dataValidNotClassFormatPublic()
4966

5067

5168
/**
52-
* Test valid public function/method names.
69+
* Test invalid public function/method names.
5370
*
54-
* @param string $name The tested name.
55-
* @param bool $strict Value of the $strict flag.
71+
* @param string $name The tested name.
5672
*
57-
* @dataProvider dataValidNotClassFormatPublic
73+
* @dataProvider dataInvalidNotClassFormatPublic
5874
*
5975
* @return void
6076
*/
61-
public function testValidNotClassFormatPublic($name, $strict)
77+
public function testInvalidNotClassFormatPublic($name)
6278
{
63-
$this->assertTrue(Common::isCamelCaps($name, false, true, $strict));
79+
$this->assertFalse(Common::isCamelCaps($name, false, true, true));
6480

65-
}//end testValidNotClassFormatPublic()
81+
}//end testInvalidNotClassFormatPublic()
6682

6783

6884
/**
@@ -124,19 +140,20 @@ public static function dataInvalidNotClassFormatPublic()
124140

125141

126142
/**
127-
* Test invalid public function/method names.
143+
* Test valid private method names.
128144
*
129-
* @param string $name The tested name.
145+
* @param string $name The tested name.
146+
* @param bool $strict Value of the $strict flag.
130147
*
131-
* @dataProvider dataInvalidNotClassFormatPublic
148+
* @dataProvider dataValidNotClassFormatPrivate
132149
*
133150
* @return void
134151
*/
135-
public function testInvalidNotClassFormatPublic($name)
152+
public function testValidNotClassFormatPrivate($name, $strict)
136153
{
137-
$this->assertFalse(Common::isCamelCaps($name, false, true, true));
154+
$this->assertTrue(Common::isCamelCaps($name, false, false, $strict));
138155

139-
}//end testInvalidNotClassFormatPublic()
156+
}//end testValidNotClassFormatPrivate()
140157

141158

142159
/**
@@ -175,20 +192,20 @@ public static function dataValidNotClassFormatPrivate()
175192

176193

177194
/**
178-
* Test valid private method names.
195+
* Test invalid private method names.
179196
*
180197
* @param string $name The tested name.
181198
* @param bool $strict Value of the $strict flag.
182199
*
183-
* @dataProvider dataValidNotClassFormatPrivate
200+
* @dataProvider dataInvalidNotClassFormatPrivate
184201
*
185202
* @return void
186203
*/
187-
public function testValidNotClassFormatPrivate($name, $strict)
204+
public function testInvalidNotClassFormatPrivate($name, $strict)
188205
{
189-
$this->assertTrue(Common::isCamelCaps($name, false, false, $strict));
206+
$this->assertFalse(Common::isCamelCaps($name, false, false, $strict));
190207

191-
}//end testValidNotClassFormatPrivate()
208+
}//end testInvalidNotClassFormatPrivate()
192209

193210

194211
/**
@@ -255,20 +272,20 @@ public static function dataInvalidNotClassFormatPrivate()
255272

256273

257274
/**
258-
* Test invalid private method names.
275+
* Test valid class names.
259276
*
260277
* @param string $name The tested name.
261278
* @param bool $strict Value of the $strict flag.
262279
*
263-
* @dataProvider dataInvalidNotClassFormatPrivate
280+
* @dataProvider dataValidClassFormatPublic
264281
*
265282
* @return void
266283
*/
267-
public function testInvalidNotClassFormatPrivate($name, $strict)
284+
public function testValidClassFormatPublic($name, $strict)
268285
{
269-
$this->assertFalse(Common::isCamelCaps($name, false, false, $strict));
286+
$this->assertTrue(Common::isCamelCaps($name, true, true, $strict));
270287

271-
}//end testInvalidNotClassFormatPrivate()
288+
}//end testValidClassFormatPublic()
272289

273290

274291
/**
@@ -320,29 +337,28 @@ public static function dataValidClassFormatPublic()
320337

321338

322339
/**
323-
* Test valid class names.
340+
* Test invalid class names.
324341
*
325-
* @param string $name The tested name.
326-
* @param bool $strict Value of the $strict flag.
342+
* @param string $name The tested name.
327343
*
328-
* @dataProvider dataValidClassFormatPublic
344+
* @dataProvider dataInvalidClassFormat
329345
*
330346
* @return void
331347
*/
332-
public function testValidClassFormatPublic($name, $strict)
348+
public function testInvalidClassFormat($name)
333349
{
334-
$this->assertTrue(Common::isCamelCaps($name, true, true, $strict));
350+
$this->assertFalse(Common::isCamelCaps($name, true));
335351

336-
}//end testValidClassFormatPublic()
352+
}//end testInvalidClassFormat()
337353

338354

339-
/**
340-
* Data provider.
341-
*
342-
* @see testInvalidClassFormat()
343-
*
344-
* @return array<string, array<string, string>>
345-
*/
355+
/**
356+
* Data provider.
357+
*
358+
* @see testInvalidClassFormat()
359+
*
360+
* @return array<string, array<string, string>>
361+
*/
346362
public static function dataInvalidClassFormat()
347363
{
348364
return [
@@ -364,19 +380,23 @@ public static function dataInvalidClassFormat()
364380

365381

366382
/**
367-
* Test invalid class names.
383+
* Test invalid class names with the private flag set.
368384
*
369-
* @param string $name The tested name.
385+
* Note that the private flag is ignored if the class format
386+
* flag is set, so these names are all invalid.
370387
*
371-
* @dataProvider dataInvalidClassFormat
388+
* @param string $name The tested name.
389+
* @param bool $public Value of the $public flag.
390+
*
391+
* @dataProvider dataInvalidClassFormatPrivate
372392
*
373393
* @return void
374394
*/
375-
public function testInvalidClassFormat($name)
395+
public function testInvalidClassFormatPrivate($name, $public)
376396
{
377-
$this->assertFalse(Common::isCamelCaps($name, true));
397+
$this->assertFalse(Common::isCamelCaps($name, true, $public));
378398

379-
}//end testInvalidClassFormat()
399+
}//end testInvalidClassFormatPrivate()
380400

381401

382402
/**
@@ -411,23 +431,19 @@ public static function dataInvalidClassFormatPrivate()
411431

412432

413433
/**
414-
* Test invalid class names with the private flag set.
415-
*
416-
* Note that the private flag is ignored if the class format
417-
* flag is set, so these names are all invalid.
434+
* Test valid strings with default arguments.
418435
*
419-
* @param string $name The tested name.
420-
* @param bool $public Value of the $public flag.
436+
* @param string $name The tested name.
421437
*
422-
* @dataProvider dataInvalidClassFormatPrivate
438+
* @dataProvider dataValidDefaultArguments
423439
*
424440
* @return void
425441
*/
426-
public function testInvalidClassFormatPrivate($name, $public)
442+
public function testValidDefaultArguments($name)
427443
{
428-
$this->assertFalse(Common::isCamelCaps($name, true, $public));
444+
$this->assertTrue(Common::isCamelCaps($name));
429445

430-
}//end testInvalidClassFormatPrivate()
446+
}//end testValidDefaultArguments()
431447

432448

433449
/**
@@ -452,19 +468,19 @@ public static function dataValidDefaultArguments()
452468

453469

454470
/**
455-
* Test valid strings with default arguments.
471+
* Test invalid strings with default arguments.
456472
*
457473
* @param string $name The tested name.
458474
*
459-
* @dataProvider dataValidDefaultArguments
475+
* @dataProvider dataInvalidDefaultArguments
460476
*
461477
* @return void
462478
*/
463-
public function testValidDefaultArguments($name)
479+
public function testInvalidDefaultArguments($name)
464480
{
465-
$this->assertTrue(Common::isCamelCaps($name));
481+
$this->assertFalse(Common::isCamelCaps($name));
466482

467-
}//end testValidDefaultArguments()
483+
}//end testInvalidDefaultArguments()
468484

469485

470486
/**
@@ -494,20 +510,4 @@ public static function dataInvalidDefaultArguments()
494510
}//end dataInvalidDefaultArguments()
495511

496512

497-
/**
498-
* Test invalid strings with default arguments.
499-
*
500-
* @param string $name The tested name.
501-
*
502-
* @dataProvider dataInvalidDefaultArguments
503-
*
504-
* @return void
505-
*/
506-
public function testInvalidDefaultArguments($name)
507-
{
508-
$this->assertFalse(Common::isCamelCaps($name));
509-
510-
}//end testInvalidDefaultArguments()
511-
512-
513513
}//end class

0 commit comments

Comments
 (0)