Skip to content

Commit f5200b5

Browse files
authored
Merge pull request #9315 from paulbalandan/method-namecase
refactor: fix `method.nameCase` errors
2 parents 8fc60e7 + 64c8fce commit f5200b5

File tree

11 files changed

+38
-74
lines changed

11 files changed

+38
-74
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13069,12 +13069,6 @@
1306913069
'count' => 1,
1307013070
'path' => __DIR__ . '/tests/system/Database/Live/GetTest.php',
1307113071
];
13072-
$ignoreErrors[] = [
13073-
// identifier: method.nameCase
13074-
'message' => '#^Call to method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:getWhere\\(\\) with incorrect case\\: getwhere$#',
13075-
'count' => 4,
13076-
'path' => __DIR__ . '/tests/system/Database/Live/InsertTest.php',
13077-
];
1307813072
$ignoreErrors[] = [
1307913073
// identifier: property.phpDocType
1308013074
'message' => '#^PHPDoc type string of property CodeIgniter\\\\Database\\\\Live\\\\MetadataTest\\:\\:\\$seed is not the same as PHPDoc type array\\<int, class\\-string\\<CodeIgniter\\\\Database\\\\Seeder\\>\\>\\|class\\-string\\<CodeIgniter\\\\Database\\\\Seeder\\> of overridden property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$seed\\.$#',
@@ -13177,12 +13171,6 @@
1317713171
'count' => 1,
1317813172
'path' => __DIR__ . '/tests/system/Database/Live/UpdateTest.php',
1317913173
];
13180-
$ignoreErrors[] = [
13181-
// identifier: method.nameCase
13182-
'message' => '#^Call to method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:getWhere\\(\\) with incorrect case\\: getwhere$#',
13183-
'count' => 9,
13184-
'path' => __DIR__ . '/tests/system/Database/Live/UpsertTest.php',
13185-
];
1318613174
$ignoreErrors[] = [
1318713175
// identifier: argument.type
1318813176
'message' => '#^Parameter \\#1 \\$set of method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:updateFields\\(\\) expects array\\<int, CodeIgniter\\\\Database\\\\RawSql\\|string\\>\\|string, array\\<string, CodeIgniter\\\\Database\\\\RawSql\\> given\\.$#',
@@ -13543,12 +13531,6 @@
1354313531
'count' => 1,
1354413532
'path' => __DIR__ . '/tests/system/Filters/fixtures/InvalidClass.php',
1354513533
];
13546-
$ignoreErrors[] = [
13547-
// identifier: method.nameCase
13548-
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with incorrect case\\: assertInstanceof$#',
13549-
'count' => 1,
13550-
'path' => __DIR__ . '/tests/system/Format/FormatTest.php',
13551-
];
1355213534
$ignoreErrors[] = [
1355313535
// identifier: missingType.iterableValue
1355413536
'message' => '#^Method CodeIgniter\\\\Format\\\\XMLFormatterTest\\:\\:provideValidatingInvalidTags\\(\\) return type has no value type specified in iterable type iterable\\.$#',
@@ -13675,12 +13657,6 @@
1367513657
'count' => 1,
1367613658
'path' => __DIR__ . '/tests/system/HTTP/DownloadResponseTest.php',
1367713659
];
13678-
$ignoreErrors[] = [
13679-
// identifier: method.nameCase
13680-
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNull\\(\\) with incorrect case\\: AssertNull$#',
13681-
'count' => 1,
13682-
'path' => __DIR__ . '/tests/system/HTTP/Files/FileCollectionTest.php',
13683-
];
1368413660
$ignoreErrors[] = [
1368513661
// identifier: missingType.return
1368613662
'message' => '#^Function CodeIgniter\\\\HTTP\\\\Files\\\\is_uploaded_file\\(\\) has no return type specified\\.$#',
@@ -16843,12 +16819,6 @@
1684316819
'count' => 1,
1684416820
'path' => __DIR__ . '/tests/system/Test/ControllerTestTraitTest.php',
1684516821
];
16846-
$ignoreErrors[] = [
16847-
// identifier: method.nameCase
16848-
'message' => '#^Call to method CodeIgniter\\\\Test\\\\ControllerTestTraitTest\\:\\:withUri\\(\\) with incorrect case\\: withURI$#',
16849-
'count' => 17,
16850-
'path' => __DIR__ . '/tests/system/Test/ControllerTestTraitTest.php',
16851-
];
1685216822
$ignoreErrors[] = [
1685316823
// identifier: class.notFound
1685416824
'message' => '#^Class App\\\\Controllers\\\\NeverHeardOfIt not found\\.$#',
@@ -17317,12 +17287,6 @@
1731717287
'count' => 1,
1731817288
'path' => __DIR__ . '/tests/system/Validation/FileRulesTest.php',
1731917289
];
17320-
$ignoreErrors[] = [
17321-
// identifier: method.nameCase
17322-
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with incorrect case\\: assertsame$#',
17323-
'count' => 2,
17324-
'path' => __DIR__ . '/tests/system/Validation/FormatRulesTest.php',
17325-
];
1732617290
$ignoreErrors[] = [
1732717291
// identifier: missingType.iterableValue
1732817292
'message' => '#^Method CodeIgniter\\\\Validation\\\\FormatRulesTest\\:\\:alphaNumericProvider\\(\\) return type has no value type specified in iterable type iterable\\.$#',

system/Test/ControllerTestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* $this->withRequest($request)
3333
* ->withResponse($response)
34-
* ->withURI($uri)
34+
* ->withUri($uri)
3535
* ->withBody($body)
3636
* ->controller('App\Controllers\Home')
3737
* ->execute('methodName');

tests/system/Database/Live/InsertTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function testReplaceWithNoMatchingData(): void
9797
$this->db->table('job')->replace($data);
9898

9999
$row = $this->db->table('job')
100-
->getwhere(['id' => 5])
100+
->getWhere(['id' => 5])
101101
->getRow();
102102

103103
$this->assertSame('Cab Driver', $row->name);
@@ -114,7 +114,7 @@ public function testReplaceWithMatchingData(): void
114114
$this->db->table('job')->replace($data);
115115

116116
$row = $this->db->table('job')
117-
->getwhere(['id' => 1])
117+
->getWhere(['id' => 1])
118118
->getRow();
119119

120120
$this->assertSame('Cab Driver', $row->name);
@@ -135,7 +135,7 @@ public function testReplaceTwice(): void
135135
$builder->replace($data);
136136

137137
$row = $this->db->table('job')
138-
->getwhere(['id' => 1])
138+
->getWhere(['id' => 1])
139139
->getRow();
140140
$this->assertSame('John Smith', $row->name);
141141

@@ -147,7 +147,7 @@ public function testReplaceTwice(): void
147147
$builder->replace($data);
148148

149149
$row = $this->db->table('job')
150-
->getwhere(['id' => 2])
150+
->getWhere(['id' => 2])
151151
->getRow();
152152
$this->assertSame('Hans Schmidt', $row->name);
153153
}

tests/system/Database/Live/UpsertTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function testUpsertChangePrimaryKeyOnUniqueIndex(): void
190190
->upsert($userData);
191191

192192
$new = $this->db->table('user')
193-
->getwhere(['email' => '[email protected]'])
193+
->getWhere(['email' => '[email protected]'])
194194
->getRow();
195195

196196
$this->assertSame(5, (int) $new->id);
@@ -460,7 +460,7 @@ public function testUpsertWithMatchingDataOnUniqueIndexandPrimaryKey(): void
460460
$this->db->table('user')->upsert($data);
461461

462462
$original = $this->db->table('user')
463-
->getwhere(['id' => 6])
463+
->getWhere(['id' => 6])
464464
->getRow();
465465

466466
$data = [
@@ -474,7 +474,7 @@ public function testUpsertWithMatchingDataOnUniqueIndexandPrimaryKey(): void
474474

475475
// get by id
476476
$row = $this->db->table('user')
477-
->getwhere(['id' => 6])
477+
->getWhere(['id' => 6])
478478
->getRow();
479479

480480
$this->assertSame('Random Name 356', $row->name);
@@ -508,17 +508,17 @@ public function testUpsertBatchOnPrimaryKey(): void
508508

509509
// get by id
510510
$row1 = $this->db->table('user')
511-
->getwhere(['id' => 1])
511+
->getWhere(['id' => 1])
512512
->getRow();
513513

514514
// get by id
515515
$row2 = $this->db->table('user')
516-
->getwhere(['id' => 2])
516+
->getWhere(['id' => 2])
517517
->getRow();
518518

519519
// get by id
520520
$row3 = $this->db->table('user')
521-
->getwhere(['id' => 3])
521+
->getWhere(['id' => 3])
522522
->getRow();
523523

524524
$this->assertSame('Upsert One On Id', $row1->name);
@@ -553,17 +553,17 @@ public function testUpsertBatchOnNullAutoIncrement(): void
553553

554554
// get by id
555555
$row1 = $this->db->table('user')
556-
->getwhere(['email' => '[email protected]'])
556+
->getWhere(['email' => '[email protected]'])
557557
->getRow();
558558

559559
// get by id
560560
$row2 = $this->db->table('user')
561-
->getwhere(['email' => '[email protected]'])
561+
->getWhere(['email' => '[email protected]'])
562562
->getRow();
563563

564564
// get by id
565565
$row3 = $this->db->table('user')
566-
->getwhere(['email' => '[email protected]'])
566+
->getWhere(['email' => '[email protected]'])
567567
->getRow();
568568

569569
$this->assertSame('Null One', $row1->name);

tests/system/Format/FormatTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testFormatConfigType(): void
4242

4343
public function testGetFormatter(): void
4444
{
45-
$this->assertInstanceof(FormatterInterface::class, $this->format->getFormatter('application/json'));
45+
$this->assertInstanceOf(FormatterInterface::class, $this->format->getFormatter('application/json'));
4646
}
4747

4848
public function testGetFormatterExpectsExceptionOnUndefinedMime(): void

tests/system/HTTP/Files/FileCollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ public function testFileNoExistSingleFile(): void
524524

525525
$collection = new FileCollection();
526526
$file = $collection->getFile('fileuser');
527-
$this->AssertNull($file);
527+
$this->assertNull($file);
528528
}
529529

530530
public function testFileReturnValidMultipleFiles(): void

tests/system/Test/ControllerTestTraitTest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testBadController(): void
4949
{
5050
$this->expectException('InvalidArgumentException');
5151
$logger = new Logger(new LoggerConfig());
52-
$this->withURI('http://example.com')
52+
$this->withUri('http://example.com')
5353
->withLogger($logger)
5454
->controller(NeverHeardOfIt::class)
5555
->execute('index');
@@ -59,7 +59,7 @@ public function testBadControllerMethod(): void
5959
{
6060
$this->expectException('InvalidArgumentException');
6161
$logger = new Logger(new LoggerConfig());
62-
$this->withURI('http://example.com')
62+
$this->withUri('http://example.com')
6363
->withLogger($logger)
6464
->controller(Home::class)
6565
->execute('nothere');
@@ -68,7 +68,7 @@ public function testBadControllerMethod(): void
6868
public function testController(): void
6969
{
7070
$logger = new Logger(new LoggerConfig());
71-
$result = $this->withURI('http://example.com')
71+
$result = $this->withUri('http://example.com')
7272
->withLogger($logger)
7373
->controller(Home::class)
7474
->execute('index');
@@ -78,7 +78,7 @@ public function testController(): void
7878

7979
public function testControllerWithoutLogger(): void
8080
{
81-
$result = $this->withURI('http://example.com')
81+
$result = $this->withUri('http://example.com')
8282
->controller(Home::class)
8383
->execute('index');
8484

@@ -88,7 +88,7 @@ public function testControllerWithoutLogger(): void
8888
public function testPopcornIndex(): void
8989
{
9090
$logger = new Logger(new LoggerConfig());
91-
$result = $this->withURI('http://example.com')
91+
$result = $this->withUri('http://example.com')
9292
->withLogger($logger)
9393
->controller(Popcorn::class)
9494
->execute('index');
@@ -99,7 +99,7 @@ public function testPopcornIndex(): void
9999
public function testPopcornIndex2(): void
100100
{
101101
$logger = new Logger(new LoggerConfig());
102-
$result = $this->withURI('http://example.com')
102+
$result = $this->withUri('http://example.com')
103103
->withLogger($logger)
104104
->controller(Popcorn::class)
105105
->execute('index');
@@ -111,7 +111,7 @@ public function testPopcornIndex2(): void
111111
public function testPopcornFailure(): void
112112
{
113113
$logger = new Logger(new LoggerConfig());
114-
$result = $this->withURI('http://example.com')
114+
$result = $this->withUri('http://example.com')
115115
->withLogger($logger)
116116
->controller(Popcorn::class)
117117
->execute('pop');
@@ -122,7 +122,7 @@ public function testPopcornFailure(): void
122122
public function testPopcornException(): void
123123
{
124124
$logger = new Logger(new LoggerConfig());
125-
$result = $this->withURI('http://example.com')
125+
$result = $this->withUri('http://example.com')
126126
->withLogger($logger)
127127
->controller(Popcorn::class)
128128
->execute('popper');
@@ -136,7 +136,7 @@ public function testPopcornIndexWithSupport(): void
136136
$config = new App();
137137
$body = '';
138138

139-
$result = $this->withURI('http://example.com')
139+
$result = $this->withUri('http://example.com')
140140
->withConfig($config)
141141
->withRequest(service('request', $config))
142142
->withResponse(service('response', $config))
@@ -152,7 +152,7 @@ public function testPopcornIndexWithSupport(): void
152152
public function testRequestPassthrough(): void
153153
{
154154
$logger = new Logger(new LoggerConfig());
155-
$result = $this->withURI('http://example.com')
155+
$result = $this->withUri('http://example.com')
156156
->withLogger($logger)
157157
->controller(Popcorn::class)
158158
->execute('popper');
@@ -164,7 +164,7 @@ public function testRequestPassthrough(): void
164164
public function testFailureResponse(): void
165165
{
166166
$logger = new Logger(new LoggerConfig());
167-
$result = $this->withURI('http://example.com')
167+
$result = $this->withUri('http://example.com')
168168
->withLogger($logger)
169169
->controller(Popcorn::class)
170170
->execute('oops');
@@ -176,7 +176,7 @@ public function testFailureResponse(): void
176176
public function testEmptyResponse(): void
177177
{
178178
$logger = new Logger(new LoggerConfig());
179-
$result = $this->withURI('http://example.com')
179+
$result = $this->withUri('http://example.com')
180180
->withLogger($logger)
181181
->controller(Popcorn::class)
182182
->execute('weasel');
@@ -189,7 +189,7 @@ public function testEmptyResponse(): void
189189
public function testRedirect(): void
190190
{
191191
$logger = new Logger(new LoggerConfig());
192-
$result = $this->withURI('http://example.com')
192+
$result = $this->withUri('http://example.com')
193193
->withLogger($logger)
194194
->controller(Popcorn::class)
195195
->execute('goaway');
@@ -200,7 +200,7 @@ public function testRedirect(): void
200200
public function testDOMParserForward(): void
201201
{
202202
$logger = new Logger(new LoggerConfig());
203-
$result = $this->withURI('http://example.com')
203+
$result = $this->withUri('http://example.com')
204204
->withLogger($logger)
205205
->controller(Popcorn::class)
206206
->execute('index');
@@ -211,7 +211,7 @@ public function testDOMParserForward(): void
211211
public function testFailsForward(): void
212212
{
213213
$logger = new Logger(new LoggerConfig());
214-
$result = $this->withURI('http://example.com')
214+
$result = $this->withUri('http://example.com')
215215
->withLogger($logger)
216216
->controller(Popcorn::class)
217217
->execute('index');
@@ -225,7 +225,7 @@ public function testFailsForward(): void
225225
*/
226226
public function testResponseOverriding(): void
227227
{
228-
$result = $this->withURI('http://example.com/rest/')
228+
$result = $this->withUri('http://example.com/rest/')
229229
->controller(Popcorn::class)
230230
->execute('index3');
231231

@@ -271,7 +271,7 @@ public function throwsBody(): never
271271

272272
public function testWithUriUpdatesUriStringAndCurrentUrlValues(): void
273273
{
274-
$result = $this->withURI('http://example.com/foo/bar/1/2/3')
274+
$result = $this->withUri('http://example.com/foo/bar/1/2/3')
275275
->controller(Newautorouting::class)
276276
->execute('postSave', '1', '2', '3');
277277

tests/system/Validation/FormatRulesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ public function testIntegerWithInvalidTypeData($value, bool $expected): void
789789
$data = [
790790
'foo' => $value,
791791
];
792-
$this->assertsame($expected, $this->validation->run($data));
792+
$this->assertSame($expected, $this->validation->run($data));
793793
}
794794

795795
/**
@@ -807,7 +807,7 @@ public function testNumericWithInvalidTypeData($value, bool $expected): void
807807
$data = [
808808
'foo' => $value,
809809
];
810-
$this->assertsame($expected, $this->validation->run($data));
810+
$this->assertSame($expected, $this->validation->run($data));
811811
}
812812

813813
public static function provideInvalidIntegerType(): iterable

user_guide_src/source/testing/controllers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Allows you to provide a **Logger** instance:
9090
If you do not provide one, a new Logger instance with the default configuration values will be passed
9191
into your controller.
9292

93-
withURI(string $uri)
93+
withUri(string $uri)
9494
--------------------
9595

9696
Allows you to provide a new URI that simulates the URL the client was visiting when this controller was run.

user_guide_src/source/testing/controllers/002.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ForumControllerTest extends CIUnitTestCase
1313

1414
public function testShowCategories()
1515
{
16-
$result = $this->withURI('http://example.com/categories')
16+
$result = $this->withUri('http://example.com/categories')
1717
->controller(ForumController::class)
1818
->execute('showCategories');
1919

0 commit comments

Comments
 (0)