Skip to content

Commit eff6872

Browse files
committed
Fix PHPUnit 10.3 soft deprecations
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent eae978f commit eff6872

60 files changed

Lines changed: 450 additions & 534 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

phpstan-baseline.neon

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29131,7 +29131,7 @@ parameters:
2913129131
path: test/classes/Controllers/Table/IndexesControllerTest.php
2913229132

2913329133
-
29134-
message: "#^Cannot call method will\\(\\) on mixed\\.$#"
29134+
message: "#^Cannot call method willReturn\\(\\) on mixed\\.$#"
2913529135
count: 1
2913629136
path: test/classes/Controllers/Table/IndexesControllerTest.php
2913729137

@@ -29221,7 +29221,7 @@ parameters:
2922129221
path: test/classes/Controllers/Table/RelationControllerTest.php
2922229222

2922329223
-
29224-
message: "#^Cannot call method will\\(\\) on mixed\\.$#"
29224+
message: "#^Cannot call method willReturn\\(\\) on mixed\\.$#"
2922529225
count: 4
2922629226
path: test/classes/Controllers/Table/RelationControllerTest.php
2922729227

@@ -29301,7 +29301,7 @@ parameters:
2930129301
path: test/classes/Controllers/Table/SearchControllerTest.php
2930229302

2930329303
-
29304-
message: "#^Cannot call method will\\(\\) on mixed\\.$#"
29304+
message: "#^Cannot call method willReturn\\(\\) on mixed\\.$#"
2930529305
count: 1
2930629306
path: test/classes/Controllers/Table/SearchControllerTest.php
2930729307

@@ -29501,7 +29501,7 @@ parameters:
2950129501
path: test/classes/Controllers/Triggers/IndexControllerTest.php
2950229502

2950329503
-
29504-
message: "#^Cannot call method will\\(\\) on mixed\\.$#"
29504+
message: "#^Cannot call method willReturn\\(\\) on mixed\\.$#"
2950529505
count: 1
2950629506
path: test/classes/Controllers/Triggers/IndexControllerTest.php
2950729507

@@ -29636,7 +29636,7 @@ parameters:
2963629636
path: test/classes/Database/CentralColumnsTest.php
2963729637

2963829638
-
29639-
message: "#^Cannot call method will\\(\\) on mixed\\.$#"
29639+
message: "#^Cannot call method willReturn\\(\\) on mixed\\.$#"
2964029640
count: 9
2964129641
path: test/classes/Database/CentralColumnsTest.php
2964229642

@@ -32521,7 +32521,7 @@ parameters:
3252132521
path: test/classes/Table/IndexesTest.php
3252232522

3252332523
-
32524-
message: "#^Cannot call method will\\(\\) on mixed\\.$#"
32524+
message: "#^Cannot call method willReturn\\(\\) on mixed\\.$#"
3252532525
count: 1
3252632526
path: test/classes/Table/IndexesTest.php
3252732527

@@ -32611,8 +32611,13 @@ parameters:
3261132611
path: test/classes/TableTest.php
3261232612

3261332613
-
32614-
message: "#^Cannot call method will\\(\\) on mixed\\.$#"
32615-
count: 3
32614+
message: "#^Cannot call method willReturn\\(\\) on mixed\\.$#"
32615+
count: 1
32616+
path: test/classes/TableTest.php
32617+
32618+
-
32619+
message: "#^Cannot call method willReturnMap\\(\\) on mixed\\.$#"
32620+
count: 2
3261632621
path: test/classes/TableTest.php
3261732622

3261832623
-

psalm-baseline.xml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.14.0@b2942cefed8443002bd3f245c4cd0a54193716d8">
2+
<files psalm-version="5.14.1@b9d355e0829c397b9b3b47d0c0ed042a8a70284d">
33
<file src="libraries/classes/Advisory/Advisor.php">
44
<ArgumentTypeCoercion>
55
<code>$pattern</code>
@@ -13452,7 +13452,7 @@
1345213452
<file src="test/classes/Controllers/Table/IndexesControllerTest.php">
1345313453
<MixedMethodCall>
1345413454
<code>method</code>
13455-
<code>will</code>
13455+
<code>willReturn</code>
1345613456
</MixedMethodCall>
1345713457
<UndefinedMethod>
1345813458
<code>expects</code>
@@ -13524,10 +13524,10 @@
1352413524
<code>method</code>
1352513525
<code>method</code>
1352613526
<code>method</code>
13527-
<code>will</code>
13528-
<code>will</code>
13529-
<code>will</code>
13530-
<code>will</code>
13527+
<code>willReturn</code>
13528+
<code>willReturn</code>
13529+
<code>willReturn</code>
13530+
<code>willReturn</code>
1353113531
</MixedMethodCall>
1353213532
<UndefinedMethod>
1353313533
<code>expects</code>
@@ -13539,7 +13539,7 @@
1353913539
<file src="test/classes/Controllers/Table/SearchControllerTest.php">
1354013540
<MixedMethodCall>
1354113541
<code>method</code>
13542-
<code>will</code>
13542+
<code>willReturn</code>
1354313543
<code>with</code>
1354413544
</MixedMethodCall>
1354513545
<UndefinedMethod>
@@ -13557,7 +13557,7 @@
1355713557
</MixedAssignment>
1355813558
<MixedMethodCall>
1355913559
<code>method</code>
13560-
<code>will</code>
13560+
<code>willReturn</code>
1356113561
</MixedMethodCall>
1356213562
<PossiblyUnusedMethod>
1356313563
<code>providerGetDataFromRequest</code>
@@ -13658,15 +13658,15 @@
1365813658
<code>method</code>
1365913659
<code>method</code>
1366013660
<code>method</code>
13661-
<code>will</code>
13662-
<code>will</code>
13663-
<code>will</code>
13664-
<code>will</code>
13665-
<code>will</code>
13666-
<code>will</code>
13667-
<code>will</code>
13668-
<code>will</code>
13669-
<code>will</code>
13661+
<code>willReturn</code>
13662+
<code>willReturn</code>
13663+
<code>willReturn</code>
13664+
<code>willReturn</code>
13665+
<code>willReturn</code>
13666+
<code>willReturn</code>
13667+
<code>willReturn</code>
13668+
<code>willReturn</code>
13669+
<code>willReturn</code>
1367013670
<code>willReturnOnConsecutiveCalls</code>
1367113671
<code>with</code>
1367213672
<code>with</code>
@@ -14594,7 +14594,7 @@
1459414594
</MixedArgument>
1459514595
<MixedMethodCall>
1459614596
<code>method</code>
14597-
<code>will</code>
14597+
<code>willReturn</code>
1459814598
</MixedMethodCall>
1459914599
<UndefinedMethod>
1460014600
<code>expects</code>
@@ -14618,9 +14618,9 @@
1461814618
<code>method</code>
1461914619
<code>method</code>
1462014620
<code>method</code>
14621-
<code>will</code>
14622-
<code>will</code>
14623-
<code>will</code>
14621+
<code>willReturn</code>
14622+
<code>willReturnMap</code>
14623+
<code>willReturnMap</code>
1462414624
</MixedMethodCall>
1462514625
<PossiblyUnusedMethod>
1462614626
<code>dataValidateName</code>

test/classes/AbstractNetworkTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function mockResponse(array|string|StringContains ...$param): MockObject
5959
$mockResponse->expects($this->any())
6060
->method('headersSent')
6161
->with()
62-
->will($this->returnValue(false));
62+
->willReturn(false);
6363

6464
if ($param !== []) {
6565
if (is_array($param[0])) {

test/classes/Config/FormDisplayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function testProcess(): void
100100
$this->object->expects($this->once())
101101
->method('save')
102102
->with([0, 1, 2], false)
103-
->will($this->returnValue(true));
103+
->willReturn(true);
104104

105105
$this->assertTrue(
106106
$this->object->process(false, false),

test/classes/ConfigStorage/RelationCleanupTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testColumnWithRelations(): void
3939

4040
$dbi = $this->createMock(DatabaseInterface::class);
4141
$dbi->expects($this->any())->method('quoteString')
42-
->will($this->returnCallback(static fn (string $string): string => "'" . $string . "'"));
42+
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
4343
$result = $this->createStub(ResultInterface::class);
4444
$dbi->expects($this->exactly(4))->method('queryAsControlUser')->willReturnMap([
4545
[
@@ -98,7 +98,7 @@ public function testTableWithRelations(): void
9898

9999
$dbi = $this->createMock(DatabaseInterface::class);
100100
$dbi->expects($this->any())->method('quoteString')
101-
->will($this->returnCallback(static fn (string $string): string => "'" . $string . "'"));
101+
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
102102
$result = $this->createStub(ResultInterface::class);
103103
$dbi->expects($this->exactly(7))->method('queryAsControlUser')->willReturnMap([
104104
["DELETE FROM `pmadb`.`column_info` WHERE db_name = 'database' AND table_name = 'table'", $result],
@@ -154,7 +154,7 @@ public function testDatabaseWithRelations(): void
154154

155155
$dbi = $this->createMock(DatabaseInterface::class);
156156
$dbi->expects($this->any())->method('quoteString')
157-
->will($this->returnCallback(static fn (string $string): string => "'" . $string . "'"));
157+
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
158158
$result = $this->createStub(ResultInterface::class);
159159
$dbi->expects($this->exactly(11))->method('queryAsControlUser')->willReturnMap([
160160
["DELETE FROM `pmadb`.`column_info` WHERE db_name = 'database'", $result],
@@ -212,7 +212,7 @@ public function testUserWithRelations(): void
212212

213213
$dbi = $this->createMock(DatabaseInterface::class);
214214
$dbi->expects($this->any())->method('quoteString')
215-
->will($this->returnCallback(static fn (string $string): string => "'" . $string . "'"));
215+
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
216216
$result = $this->createStub(ResultInterface::class);
217217
$dbi->expects($this->exactly(10))->method('queryAsControlUser')->willReturnMap([
218218
["DELETE FROM `pmadb`.`bookmark` WHERE `user` = 'user'", $result],

test/classes/ConfigStorage/RelationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function testPMAGetComments(): void
7676
['Field' => 'field2', 'Type' => 'text', 'Comment' => 'Comment1'],
7777
];
7878
$dbi->expects($this->any())->method('getColumns')
79-
->will($this->returnValue($getColumnsResult));
79+
->willReturn($getColumnsResult);
8080

8181
$relation = new Relation($dbi);
8282

@@ -108,13 +108,13 @@ public function testPMATryUpgradeTransformations(): void
108108
->getMock();
109109
$dbi->expects($this->any())
110110
->method('tryQueryAsControlUser')
111-
->will($this->returnValue($resultStub));
111+
->willReturn($resultStub);
112112
$resultStub->expects($this->any())
113113
->method('numRows')
114-
->will($this->returnValue(0));
114+
->willReturn(0);
115115
$dbi->expects($this->any())
116116
->method('getError')
117-
->will($this->onConsecutiveCalls('Error', ''));
117+
->willReturn('Error', '');
118118
$GLOBALS['dbi'] = $dbi;
119119

120120
$relation = new Relation($dbi);

test/classes/ConfigStorage/UserGroupsTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ public function testGetHtmlForUserGroupsTableWithNoUserGroups(): void
5757
$dbi->expects($this->once())
5858
->method('tryQueryAsControlUser')
5959
->with($expectedQuery)
60-
->will($this->returnValue($resultStub));
60+
->willReturn($resultStub);
6161
$resultStub->expects($this->once())
6262
->method('numRows')
63-
->will($this->returnValue(0));
63+
->willReturn(0);
6464
$GLOBALS['dbi'] = $dbi;
6565

6666
$html = UserGroups::getHtmlForUserGroupsTable($this->configurableMenusFeature);
@@ -104,7 +104,7 @@ public function testDeleteUserGroup(): void
104104
[$userGrpDelQuery, $result],
105105
]);
106106
$dbi->expects($this->any())->method('quoteString')
107-
->will($this->returnCallback(static fn (string $string): string => "'" . $string . "'"));
107+
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
108108

109109
UserGroups::delete($dbi, $this->configurableMenusFeature, 'ug');
110110
}
@@ -128,14 +128,14 @@ public function testGetHtmlToEditUserGroup(): void
128128
$dbi->expects($this->once())
129129
->method('tryQueryAsControlUser')
130130
->with($expectedQuery)
131-
->will($this->returnValue($resultStub));
131+
->willReturn($resultStub);
132132
$resultStub->expects($this->exactly(1))
133133
->method('getIterator')
134-
->will($this->returnCallback(static function (): Generator {
134+
->willReturnCallback(static function (): Generator {
135135
yield from [['usergroup' => 'user<br>group', 'tab' => 'server_sql', 'allowed' => 'Y']];
136-
}));
136+
});
137137
$dbi->expects($this->any())->method('quoteString')
138-
->will($this->returnCallback(static fn (string $string): string => "'" . $string . "'"));
138+
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
139139

140140
$GLOBALS['dbi'] = $dbi;
141141

test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testGetForeignKeyConstrainsForTable(): void
4545
/** @var TablesController $multiTableQueryController */
4646
$multiTableQueryController = $GLOBALS['containerBuilder']->get(TablesController::class);
4747
$request = $this->createStub(ServerRequest::class);
48-
$request->method('getQueryParam')->willReturnOnConsecutiveCalls($_GET['tables'], $_GET['db']);
48+
$request->method('getQueryParam')->willReturn($_GET['tables'], $_GET['db']);
4949
$multiTableQueryController($request);
5050
$this->assertSame(
5151
[

test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testSynchronizeFavoriteTables(): void
4444
->getMock();
4545
$favoriteInstance->expects($this->exactly(2))
4646
->method('getTables')
47-
->will($this->onConsecutiveCalls([[]], [['db' => 'db', 'table' => 'table']]));
47+
->willReturn([[]], [['db' => 'db', 'table' => 'table']]);
4848

4949
$class = new ReflectionClass(FavoriteTableController::class);
5050
$method = $class->getMethod('synchronizeFavoriteTables');

test/classes/Controllers/Database/StructureControllerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ protected function setUp(): void
5151
->getMock();
5252
// Expect the table will have 6 rows
5353
$table->expects($this->any())->method('getRealRowCountTable')
54-
->will($this->returnValue(6));
54+
->willReturn(6);
5555
$table->expects($this->any())->method('countRecords')
56-
->will($this->returnValue(6));
56+
->willReturn(6);
5757

5858
$dbi = $this->getMockBuilder(DatabaseInterface::class)
5959
->disableOriginalConstructor()
6060
->getMock();
6161
$dbi->expects($this->any())->method('getTable')
62-
->will($this->returnValue($table));
62+
->willReturn($table);
6363

6464
$GLOBALS['dbi'] = $dbi;
6565

0 commit comments

Comments
 (0)