File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717use stdClass ;
1818
1919use function __ ;
20- use function intval ;
2120use function is_array ;
2221use function json_decode ;
2322use function str_contains ;
@@ -74,7 +73,7 @@ public function getHtmlForPageSaveAs(string $db): string
7473 *
7574 * @param string $db database name
7675 *
77- * @return mixed[] array of schema page id and names
76+ * @return array<string|null> array of schema page id and names
7877 */
7978 private function getPageIdsAndNames (string $ db ): array
8079 {
@@ -94,12 +93,7 @@ private function getPageIdsAndNames(string $db): array
9493 return [];
9594 }
9695
97- $ result = [];
98- while ($ currPage = $ pageRs ->fetchAssoc ()) {
99- $ result [intval ($ currPage ['page_nr ' ])] = $ currPage ['page_descr ' ];
100- }
101-
102- return $ result ;
96+ return $ pageRs ->fetchAllKeyPair ();
10397 }
10498
10599 /**
Original file line number Diff line number Diff line change @@ -68,13 +68,12 @@ private function mockDatabaseInteraction(string $db): void
6868 )
6969 ->willReturn ($ resultStub );
7070
71- $ resultStub ->expects ($ this ->exactly (3 ))
72- ->method ('fetchAssoc ' )
73- ->willReturn (
74- ['page_nr ' => '1 ' , 'page_descr ' => 'page1 ' ],
75- ['page_nr ' => '2 ' , 'page_descr ' => 'page2 ' ],
76- [],
77- );
71+ $ resultStub ->expects ($ this ->exactly (1 ))
72+ ->method ('fetchAllKeyPair ' )
73+ ->willReturn ([
74+ '1 ' => 'page1 ' ,
75+ '2 ' => 'page2 ' ,
76+ ]);
7877
7978 $ dbi ->expects ($ this ->any ())->method ('quoteString ' )
8079 ->willReturnCallback (static fn (string $ string ): string => "' " . $ string . "' " );
You can’t perform that action at this time.
0 commit comments