Skip to content

Commit 9781085

Browse files
committed
Fix ODBC test which may not properly clean up
If these tests fail with a fatal error, they won't properly clean up, which likely causes other tests to fail as (several ODBC tests use the `odbcTEST` database and tables or stored procedures named `FOO`). This is particularly annoying during development, where you would need to clean up manually. We fix this by moving the cleanup code to the --CLEAN-- section, so that this code is executed no matter what. Closes GH-7886.
1 parent 09165ac commit 9781085

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

ext/odbc/tests/odbc_exec_002.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ $res = odbc_exec($conn, 'SELECT * FROM FOO');
2121
var_dump(odbc_fetch_row($res));
2222
var_dump(odbc_result($res, 'test'));
2323
var_dump(odbc_fetch_array($res));
24-
24+
?>
25+
--CLEAN--
26+
<?php
27+
require 'config.inc';
28+
$conn = odbc_connect($dsn, $user, $pass);
2529
odbc_exec($conn, 'DROP TABLE FOO');
26-
2730
odbc_exec($conn, 'DROP DATABASE odbcTEST');
28-
2931
?>
3032
--EXPECT--
3133
bool(true)

ext/odbc/tests/odbc_free_result_001.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ try {
3737
} catch (TypeError $e) {
3838
echo $e->getMessage(), "\n";
3939
}
40-
40+
?>
41+
--CLEAN--
42+
<?php
43+
require 'config.inc';
44+
$conn = odbc_connect($dsn, $user, $pass);
4145
odbc_exec($conn, 'DROP TABLE FOO');
42-
4346
odbc_exec($conn, 'DROP DATABASE odbcTEST');
44-
4547
?>
4648
--EXPECT--
4749
bool(true)

0 commit comments

Comments
 (0)