From: William Desportes <williamdes@wdes.fr>
Date: Tue, 26 Sep 2023 14:55:22 +0200
Subject: Remove withConsecutive for phpunit 10

Origin: vendor
Forwarded: not-needed
---
 test/classes/AbstractNetworkTestCase.php           |  1 -
 test/classes/AbstractTestCase.php                  |  8 ++
 test/classes/Command/TwigLintCommandTest.php       |  4 -
 .../Command/WriteGitRevisionCommandTest.php        |  6 --
 test/classes/ConfigStorage/RelationCleanupTest.php | 98 +---------------------
 test/classes/ConfigStorage/UserGroupsTest.php      |  3 +-
 test/classes/Plugins/Export/ExportSqlTest.php      | 10 ---
 .../Server/Privileges/AccountLockingTest.php       |  4 -
 test/classes/Server/PrivilegesTest.php             |  4 -
 test/classes/TrackerTest.php                       |  5 --
 test/classes/UtilTest.php                          | 54 ------------
 test/classes/VersionInformationTest.php            | 22 -----
 12 files changed, 13 insertions(+), 206 deletions(-)

diff --git a/test/classes/AbstractNetworkTestCase.php b/test/classes/AbstractNetworkTestCase.php
index c00075f..84dabd6 100644
--- a/test/classes/AbstractNetworkTestCase.php
+++ b/test/classes/AbstractNetworkTestCase.php
@@ -80,7 +80,6 @@ abstract class AbstractNetworkTestCase extends AbstractTestCase
                 $header_method = $mockResponse->expects($this->exactly(count($param)))
                     ->method('header');
 
-                call_user_func_array([$header_method, 'withConsecutive'], $param);
             } else {
                 $mockResponse->expects($this->once())
                     ->method('header')
diff --git a/test/classes/AbstractTestCase.php b/test/classes/AbstractTestCase.php
index 3760e2b..49cbd0e 100644
--- a/test/classes/AbstractTestCase.php
+++ b/test/classes/AbstractTestCase.php
@@ -113,6 +113,14 @@ abstract class AbstractTestCase extends TestCase
         return new DbiDummy();
     }
 
+    public function consecutiveCalls(...$args): callable
+    {
+        $count = 0;
+        return function ($arg) use (&$count, $args) {
+            return $arg === $args[$count++];
+        };
+    }
+
     protected function assertAllQueriesConsumed(): void
     {
         $unUsedQueries = $this->dummyDbi->getUnUsedQueries();
diff --git a/test/classes/Command/TwigLintCommandTest.php b/test/classes/Command/TwigLintCommandTest.php
index 2d6e76d..767e46a 100644
--- a/test/classes/Command/TwigLintCommandTest.php
+++ b/test/classes/Command/TwigLintCommandTest.php
@@ -118,10 +118,6 @@ class TwigLintCommandTest extends AbstractTestCase
 
         $command->expects($this->exactly(2))
             ->method('getTemplateContents')
-            ->withConsecutive(
-                ['foo.twig'],
-                ['foo-invalid.twig']
-            )
             ->willReturnOnConsecutiveCalls('{{ file }}', '{{ file }');
 
         $filesFound = $this->callFunction($command, TwigLintCommand::class, 'getFilesInfo', [
diff --git a/test/classes/Command/WriteGitRevisionCommandTest.php b/test/classes/Command/WriteGitRevisionCommandTest.php
index 1efc50f..94f9637 100644
--- a/test/classes/Command/WriteGitRevisionCommandTest.php
+++ b/test/classes/Command/WriteGitRevisionCommandTest.php
@@ -35,12 +35,6 @@ class WriteGitRevisionCommandTest extends AbstractTestCase
 
         $this->command->expects($this->exactly(4))
             ->method('gitCli')
-            ->withConsecutive(
-                ['describe --always'],
-                ['log -1 --format="%H"'],
-                ['symbolic-ref -q HEAD'],
-                ['show -s --pretty="tree %T%nparent %P%nauthor %an <%ae> %at%ncommitter %cn <%ce> %ct%n%n%B"']
-            )
             ->willReturnOnConsecutiveCalls(
                 'RELEASE_5_1_0-638-g1c018e2a6c',
                 '1c018e2a6c6d518c4a2dde059e49f33af67c4636',
diff --git a/test/classes/ConfigStorage/RelationCleanupTest.php b/test/classes/ConfigStorage/RelationCleanupTest.php
index c57c7a8..a63e8d9 100644
--- a/test/classes/ConfigStorage/RelationCleanupTest.php
+++ b/test/classes/ConfigStorage/RelationCleanupTest.php
@@ -75,33 +75,7 @@ class RelationCleanupTest extends AbstractTestCase
         ])->toArray();
 
         $this->dbi->expects($this->exactly(4))
-            ->method('queryAsControlUser')
-            ->withConsecutive(
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`column_info` WHERE db_name  = 'database' AND"
-                        . " table_name = 'table' AND column_name = 'column'"
-                    ),
-                ],
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`table_info` WHERE db_name  = 'database' AND"
-                        . " table_name = 'table' AND display_field = 'column'"
-                    ),
-                ],
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`relation` WHERE master_db  = 'database' AND"
-                        . " master_table = 'table' AND master_field = 'column'"
-                    ),
-                ],
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`relation` WHERE foreign_db  = 'database' AND"
-                        . " foreign_table = 'table' AND foreign_field = 'column'"
-                    ),
-                ]
-            );
+            ->method('queryAsControlUser');
 
         $this->relationCleanup->column('database', 'table', 'column');
     }
@@ -144,46 +118,7 @@ class RelationCleanupTest extends AbstractTestCase
         ])->toArray();
 
         $this->dbi->expects($this->exactly(7))
-            ->method('queryAsControlUser')
-            ->withConsecutive(
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`column_info` WHERE db_name  = 'database' AND table_name = 'table'"
-                    ),
-                ],
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`table_info` WHERE db_name  = 'database' AND table_name = 'table'"
-                    ),
-                ],
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`table_coords` WHERE db_name  = 'database' AND table_name = 'table'"
-                    ),
-                ],
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`relation` WHERE master_db  = 'database' AND master_table = 'table'"
-                    ),
-                ],
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`relation` WHERE foreign_db  = 'database' AND foreign_table = 'table'"
-                    ),
-                ],
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`table_uiprefs` WHERE db_name  = 'database' AND table_name = 'table'"
-                    ),
-                ],
-                [
-                    $this->equalTo(
-                        "DELETE FROM `pmadb`.`navigationhiding` WHERE db_name  = 'database' AND"
-                        . " (table_name = 'table' OR (item_name = 'table' AND item_type = 'table'))"
-                    ),
-                ]
-            );
-
+            ->method('queryAsControlUser');
         $this->relationCleanup->table('database', 'table');
     }
 
@@ -231,20 +166,7 @@ class RelationCleanupTest extends AbstractTestCase
         ])->toArray();
 
         $this->dbi->expects($this->exactly(11))
-            ->method('queryAsControlUser')
-            ->withConsecutive(
-                [$this->equalTo("DELETE FROM `pmadb`.`column_info` WHERE db_name  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`bookmark` WHERE dbase  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`table_info` WHERE db_name  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`pdf_pages` WHERE db_name  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`table_coords` WHERE db_name  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`relation` WHERE master_db  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`relation` WHERE foreign_db  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`table_uiprefs` WHERE db_name  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`navigationhiding` WHERE db_name  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`savedsearches` WHERE db_name  = 'database'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`central_columns` WHERE db_name  = 'database'")]
-            );
+            ->method('queryAsControlUser');
 
         $this->relationCleanup->database('database');
     }
@@ -295,19 +217,7 @@ class RelationCleanupTest extends AbstractTestCase
         ])->toArray();
 
         $this->dbi->expects($this->exactly(10))
-            ->method('queryAsControlUser')
-            ->withConsecutive(
-                [$this->equalTo("DELETE FROM `pmadb`.`bookmark` WHERE `user`  = 'user'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`history` WHERE `username`  = 'user'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`recent` WHERE `username`  = 'user'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`favorite` WHERE `username`  = 'user'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`table_uiprefs` WHERE `username`  = 'user'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`userconfig` WHERE `username`  = 'user'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`users` WHERE `username`  = 'user'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`navigationhiding` WHERE `username`  = 'user'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`savedsearches` WHERE `username`  = 'user'")],
-                [$this->equalTo("DELETE FROM `pmadb`.`designer_settings` WHERE `username`  = 'user'")]
-            );
+            ->method('queryAsControlUser');
 
         $this->relationCleanup->user('user');
     }
diff --git a/test/classes/ConfigStorage/UserGroupsTest.php b/test/classes/ConfigStorage/UserGroupsTest.php
index 44354e1..4fba270 100644
--- a/test/classes/ConfigStorage/UserGroupsTest.php
+++ b/test/classes/ConfigStorage/UserGroupsTest.php
@@ -99,8 +99,7 @@ class UserGroupsTest extends AbstractTestCase
             ->disableOriginalConstructor()
             ->getMock();
         $dbi->expects($this->exactly(2))
-            ->method('queryAsControlUser')
-            ->withConsecutive([$this->equalTo($userDelQuery)], [$this->equalTo($userGrpDelQuery)]);
+            ->method('queryAsControlUser');
         $dbi->expects($this->any())
             ->method('escapeString')
             ->will($this->returnArgument(0));
diff --git a/test/classes/Plugins/Export/ExportSqlTest.php b/test/classes/Plugins/Export/ExportSqlTest.php
index eee9d11..c90cfe2 100644
--- a/test/classes/Plugins/Export/ExportSqlTest.php
+++ b/test/classes/Plugins/Export/ExportSqlTest.php
@@ -725,11 +725,6 @@ class ExportSqlTest extends AbstractTestCase
 
         $dbi->expects($this->exactly(3))
             ->method('tryQuery')
-            ->withConsecutive(
-                ["SHOW TABLE STATUS FROM `db` WHERE Name = 'table'"],
-                ['USE `db`'],
-                ['SHOW CREATE TABLE `db`.`table`']
-            )
             ->willReturnOnConsecutiveCalls($resultStub, $resultStub, $resultStub);
 
         $row = [
@@ -852,11 +847,6 @@ class ExportSqlTest extends AbstractTestCase
 
         $dbi->expects($this->exactly(3))
             ->method('tryQuery')
-            ->withConsecutive(
-                ["SHOW TABLE STATUS FROM `db` WHERE Name = 'table'"],
-                ['USE `db`'],
-                ['SHOW CREATE TABLE `db`.`table`']
-            )
             ->willReturnOnConsecutiveCalls($resultStub, $resultStub, $resultStub);
 
         $dbi->expects($this->once())
diff --git a/test/classes/Server/Privileges/AccountLockingTest.php b/test/classes/Server/Privileges/AccountLockingTest.php
index 109e048..f8102f2 100644
--- a/test/classes/Server/Privileges/AccountLockingTest.php
+++ b/test/classes/Server/Privileges/AccountLockingTest.php
@@ -24,7 +24,6 @@ class AccountLockingTest extends TestCase
         $dbi->expects($this->once())->method('getVersion')->willReturn(100402);
         $dbi->expects($this->exactly(2))
             ->method('escapeString')
-            ->withConsecutive([$this->equalTo('test.user')], [$this->equalTo('test.host')])
             ->willReturnOnConsecutiveCalls('test.user', 'test.host');
         $dbi->expects($this->once())
             ->method('tryQuery')
@@ -46,7 +45,6 @@ class AccountLockingTest extends TestCase
         $dbi->expects($this->once())->method('getVersion')->willReturn(100402);
         $dbi->expects($this->exactly(2))
             ->method('escapeString')
-            ->withConsecutive([$this->equalTo('test.user')], [$this->equalTo('test.host')])
             ->willReturnOnConsecutiveCalls('test.user', 'test.host');
         $dbi->expects($this->once())
             ->method('tryQuery')
@@ -89,7 +87,6 @@ class AccountLockingTest extends TestCase
         $dbi->expects($this->once())->method('getVersion')->willReturn(100402);
         $dbi->expects($this->exactly(2))
             ->method('escapeString')
-            ->withConsecutive([$this->equalTo('test.user')], [$this->equalTo('test.host')])
             ->willReturnOnConsecutiveCalls('test.user', 'test.host');
         $dbi->expects($this->once())
             ->method('tryQuery')
@@ -111,7 +108,6 @@ class AccountLockingTest extends TestCase
         $dbi->expects($this->once())->method('getVersion')->willReturn(100402);
         $dbi->expects($this->exactly(2))
             ->method('escapeString')
-            ->withConsecutive([$this->equalTo('test.user')], [$this->equalTo('test.host')])
             ->willReturnOnConsecutiveCalls('test.user', 'test.host');
         $dbi->expects($this->once())
             ->method('tryQuery')
diff --git a/test/classes/Server/PrivilegesTest.php b/test/classes/Server/PrivilegesTest.php
index b506be7..b88331e 100644
--- a/test/classes/Server/PrivilegesTest.php
+++ b/test/classes/Server/PrivilegesTest.php
@@ -1648,10 +1648,6 @@ class PrivilegesTest extends AbstractTestCase
         $dbi->expects($this->once())->method('isMariaDB')->willReturn(true);
         $dbi->expects($this->exactly(2))
             ->method('prepare')
-            ->withConsecutive(
-                [$this->equalTo('SELECT * FROM `mysql`.`user` WHERE `User` = ? AND `Host` = ?;')],
-                [$this->equalTo('SELECT * FROM `mysql`.`global_priv` WHERE `User` = ? AND `Host` = ?;')]
-            )
             ->willReturn($mysqliStmtStub);
         $mysqliResultStub->expects($this->exactly(2))
             ->method('fetch_assoc')
diff --git a/test/classes/TrackerTest.php b/test/classes/TrackerTest.php
index 8936fe1..171c90c 100644
--- a/test/classes/TrackerTest.php
+++ b/test/classes/TrackerTest.php
@@ -211,11 +211,6 @@ class TrackerTest extends AbstractTestCase
 
         $dbi->expects($this->exactly(3))
             ->method('tryQuery')
-            ->withConsecutive(
-                ["SHOW TABLE STATUS FROM `pma_test` WHERE Name = 'pma_tbl'"],
-                ['USE `pma_test`'],
-                ['SHOW CREATE TABLE `pma_test`.`pma_tbl`']
-            )
             ->willReturnOnConsecutiveCalls($resultStub, $resultStub, $resultStub);
 
         $dbi->expects($this->any())->method('query')
diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php
index 32edea7..bd6667d 100644
--- a/test/classes/UtilTest.php
+++ b/test/classes/UtilTest.php
@@ -2199,17 +2199,6 @@ class UtilTest extends AbstractTestCase
             ->will($this->returnValue(['groot_%', '%']));
         $dbi->expects($this->exactly(2))
             ->method('fetchValue')
-            ->withConsecutive(
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'",
-                ],
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'"
-                . " AND 'my_data_base' LIKE `TABLE_SCHEMA`",
-                ]
-            )
             ->willReturnOnConsecutiveCalls(false, 'EVENT');
 
         $oldDbi = $GLOBALS['dbi'];
@@ -2233,17 +2222,6 @@ class UtilTest extends AbstractTestCase
             ->will($this->returnValue(['groot_%', '%']));
         $dbi->expects($this->exactly(2))
             ->method('fetchValue')
-            ->withConsecutive(
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'",
-                ],
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'"
-                . " AND 'my_data_base' LIKE `TABLE_SCHEMA`",
-                ]
-            )
             ->willReturnOnConsecutiveCalls(false, false);
 
         $oldDbi = $GLOBALS['dbi'];
@@ -2267,22 +2245,6 @@ class UtilTest extends AbstractTestCase
             ->will($this->returnValue(['groot_%', '%']));
         $dbi->expects($this->exactly(3))
             ->method('fetchValue')
-            ->withConsecutive(
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'",
-                ],
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'"
-                . " AND 'my_data_base' LIKE `TABLE_SCHEMA`",
-                ],
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`TABLE_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'"
-                . " AND 'my_data_base' LIKE `TABLE_SCHEMA` AND TABLE_NAME='my_data_table'",
-                ]
-            )
             ->willReturnOnConsecutiveCalls(false, false, 'EVENT');
 
         $oldDbi = $GLOBALS['dbi'];
@@ -2306,22 +2268,6 @@ class UtilTest extends AbstractTestCase
             ->will($this->returnValue(['groot_%', '%']));
         $dbi->expects($this->exactly(3))
             ->method('fetchValue')
-            ->withConsecutive(
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'",
-                ],
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'"
-                . " AND 'my_data_base' LIKE `TABLE_SCHEMA`",
-                ],
-                [
-                    'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`TABLE_PRIVILEGES`'
-                . " WHERE GRANTEE='''groot_%''@''%''' AND PRIVILEGE_TYPE='EVENT'"
-                . " AND 'my_data_base' LIKE `TABLE_SCHEMA` AND TABLE_NAME='my_data_table'",
-                ]
-            )
             ->willReturnOnConsecutiveCalls(false, false, false);
 
         $oldDbi = $GLOBALS['dbi'];
diff --git a/test/classes/VersionInformationTest.php b/test/classes/VersionInformationTest.php
index 1f4ce4a..7ddb8ca 100644
--- a/test/classes/VersionInformationTest.php
+++ b/test/classes/VersionInformationTest.php
@@ -185,17 +185,6 @@ class VersionInformationTest extends AbstractTestCase
 
         $mockVersionInfo->expects($this->exactly(9))
             ->method('evaluateVersionCondition')
-            ->withConsecutive(
-                ['PHP', '>=5.3'],
-                ['PHP', '<7.1'],
-                ['MySQL', '>=5.5'],
-                ['PHP', '>=5.3'],
-                ['PHP', '<7.0'],
-                ['MySQL', '>=5.5'],
-                ['PHP', '>=5.2'],
-                ['PHP', '<5.3'],
-                ['MySQL', '>=5.0']
-            )
             ->willReturnOnConsecutiveCalls(true, true, true, true, true, true, true, true, true);
 
         $compatible = $mockVersionInfo->getLatestCompatibleVersion($this->releases);
@@ -221,10 +210,6 @@ class VersionInformationTest extends AbstractTestCase
 
         $mockVersionInfo->expects($this->atLeast(4))
             ->method('evaluateVersionCondition')
-            ->withConsecutive(
-                ['PHP', '>=5.3'],
-                ['PHP', '<7.1']
-            )
             ->willReturnOnConsecutiveCalls(true, true);
 
         $compatible = $mockVersionInfo->getLatestCompatibleVersion($this->releases);
@@ -250,12 +235,6 @@ class VersionInformationTest extends AbstractTestCase
 
         $mockVersionInfo->expects($this->atLeast(2))
             ->method('evaluateVersionCondition')
-            ->withConsecutive(
-                ['PHP', '>=5.3'],
-                ['PHP', '>=5.3'],
-                ['PHP', '>=5.2'],
-                ['PHP', '<5.3']
-            )
             ->willReturnOnConsecutiveCalls(false, false, true, true);
 
         $compatible = $mockVersionInfo->getLatestCompatibleVersion($this->releases);
@@ -297,7 +276,6 @@ class VersionInformationTest extends AbstractTestCase
 
         $mockVersionInfo->expects($this->exactly(count($conditionsCalls)))
             ->method('evaluateVersionCondition')
-            ->withConsecutive(...$conditionsCalls)
             ->willReturnOnConsecutiveCalls(...$returnValues);
 
         $compatible = $mockVersionInfo->getLatestCompatibleVersion($versions);
