@@ -1433,4 +1433,84 @@ public function providerGetQueryFromRequest(): array
14331433 ],
14341434 ];
14351435 }
1436+
1437+ public function testGetFunctionNames (): void
1438+ {
1439+ $ dbiDummy = $ this ->createDbiDummy ();
1440+ $ dbiDummy ->addResult (
1441+ 'SHOW FUNCTION STATUS; ' ,
1442+ [
1443+ ['db_test ' , 'test_func ' , 'FUNCTION ' ],
1444+ ['test_db ' , 'test_func1 ' , 'FUNCTION ' ],
1445+ ['test_db ' , '' , 'FUNCTION ' ],
1446+ ['test_db ' , 'test_func2 ' , 'FUNCTION ' ],
1447+ ['test_db ' , 'test_func ' , 'PROCEDURE ' ],
1448+ ],
1449+ ['Db ' , 'Name ' , 'Type ' ]
1450+ );
1451+
1452+ $ names = Routines::getFunctionNames ($ this ->createDatabaseInterface ($ dbiDummy ), 'test_db ' );
1453+ $ this ->assertSame (['test_func1 ' , 'test_func2 ' ], $ names );
1454+
1455+ $ dbiDummy ->assertAllQueriesConsumed ();
1456+ }
1457+
1458+ public function testGetFunctionNamesWithEmptyReturn (): void
1459+ {
1460+ $ dbiDummy = $ this ->createDbiDummy ();
1461+ $ dbiDummy ->addResult (
1462+ 'SHOW FUNCTION STATUS; ' ,
1463+ [
1464+ ['db_test ' , 'test_func ' , 'FUNCTION ' ],
1465+ ['test_db ' , '' , 'FUNCTION ' ],
1466+ ['test_db ' , 'test_func ' , 'PROCEDURE ' ],
1467+ ],
1468+ ['Db ' , 'Name ' , 'Type ' ]
1469+ );
1470+
1471+ $ names = Routines::getFunctionNames ($ this ->createDatabaseInterface ($ dbiDummy ), 'test_db ' );
1472+ $ this ->assertSame ([], $ names );
1473+
1474+ $ dbiDummy ->assertAllQueriesConsumed ();
1475+ }
1476+
1477+ public function testGetProcedureNames (): void
1478+ {
1479+ $ dbiDummy = $ this ->createDbiDummy ();
1480+ $ dbiDummy ->addResult (
1481+ 'SHOW PROCEDURE STATUS; ' ,
1482+ [
1483+ ['db_test ' , 'test_proc ' , 'PROCEDURE ' ],
1484+ ['test_db ' , 'test_proc1 ' , 'PROCEDURE ' ],
1485+ ['test_db ' , '' , 'PROCEDURE ' ],
1486+ ['test_db ' , 'test_proc2 ' , 'PROCEDURE ' ],
1487+ ['test_db ' , 'test_proc ' , 'FUNCTION ' ],
1488+ ],
1489+ ['Db ' , 'Name ' , 'Type ' ]
1490+ );
1491+
1492+ $ names = Routines::getProcedureNames ($ this ->createDatabaseInterface ($ dbiDummy ), 'test_db ' );
1493+ $ this ->assertSame (['test_proc1 ' , 'test_proc2 ' ], $ names );
1494+
1495+ $ dbiDummy ->assertAllQueriesConsumed ();
1496+ }
1497+
1498+ public function testGetProcedureNamesWithEmptyReturn (): void
1499+ {
1500+ $ dbiDummy = $ this ->createDbiDummy ();
1501+ $ dbiDummy ->addResult (
1502+ 'SHOW PROCEDURE STATUS; ' ,
1503+ [
1504+ ['db_test ' , 'test_proc ' , 'PROCEDURE ' ],
1505+ ['test_db ' , '' , 'PROCEDURE ' ],
1506+ ['test_db ' , 'test_proc ' , 'FUNCTION ' ],
1507+ ],
1508+ ['Db ' , 'Name ' , 'Type ' ]
1509+ );
1510+
1511+ $ names = Routines::getProcedureNames ($ this ->createDatabaseInterface ($ dbiDummy ), 'test_db ' );
1512+ $ this ->assertSame ([], $ names );
1513+
1514+ $ dbiDummy ->assertAllQueriesConsumed ();
1515+ }
14361516}
0 commit comments