Skip to content

Commit faabc3f

Browse files
refactor(ext/pgsql/tests): delete table in --CLEAN--
1 parent 7b507cd commit faabc3f

20 files changed

+134
-35
lines changed

ext/pgsql/tests/06copy_2.phpt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ pg_put_line($db, "\\.\n");
2121
pg_end_copy($db);
2222

2323
var_dump(pg_fetch_all_columns(pg_query($db, 'SELECT * FROM test_copy ORDER BY 1')));
24+
?>
25+
--CLEAN--
26+
<?php
27+
include('inc/config.inc');
28+
$db = pg_connect($conn_str);
2429

2530
pg_query($db, 'DROP TABLE test_copy');
26-
2731
?>
2832
--EXPECT--
2933
array(2) {

ext/pgsql/tests/80_bug24499.phpt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ if (!$dbh) {
1616
die ("Could not connect to the server");
1717
}
1818

19-
@pg_query($dbh, "DROP SEQUENCE id_id_seq");
20-
@pg_query($dbh, "DROP TABLE id");
2119
pg_query($dbh, "CREATE TABLE id (id SERIAL, t INT)");
2220

2321
for ($i=0; $i<4; $i++) {
@@ -48,6 +46,13 @@ pg_close($dbh);
4846

4947
echo "Done\n";
5048

49+
?>
50+
--CLEAN--
51+
<?php
52+
require_once('inc/config.inc');
53+
$dbh = pg_connect($conn_str);
54+
55+
pg_query($dbh, "DROP TABLE id CASCADE");
5156
?>
5257
--EXPECTF--
5358
Array

ext/pgsql/tests/80_bug27597.phpt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ if (!$dbh) {
1616
die ("Could not connect to the server");
1717
}
1818

19-
@pg_query($dbh, "DROP TABLE id");
2019
pg_query($dbh, "CREATE TABLE id (id INT)");
2120

2221
for ($i=0; $i<4; $i++) {
@@ -40,6 +39,13 @@ while($row = xi_fetch_array($res)) {
4039

4140
pg_close($dbh);
4241

42+
?>
43+
--CLEAN--
44+
<?php
45+
require_once('inc/config.inc');
46+
$dbh = pg_connect($conn_str);
47+
48+
pg_query($dbh, "DROP TABLE id");
4349
?>
4450
--EXPECT--
4551
Array

ext/pgsql/tests/80_bug39971.phpt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ require_once('inc/skipif.inc');
1111

1212
require_once('inc/config.inc');
1313

14-
$dbh = @pg_connect($conn_str);
15-
if (!$dbh) {
16-
die ("Could not connect to the server");
17-
}
14+
$dbh = pg_connect($conn_str);
1815

1916
pg_query($dbh, "CREATE TABLE php_test (id SERIAL, tm timestamp NOT NULL)");
2017

@@ -24,9 +21,15 @@ pg_insert($dbh, 'php_test', $values);
2421
$ids = array('id' => 1);
2522
pg_update($dbh, 'php_test', $values, $ids);
2623

27-
pg_query($dbh, "DROP TABLE php_test");
2824
pg_close($dbh);
2925
?>
3026
===DONE===
27+
--CLEAN--
28+
<?php
29+
require_once('inc/config.inc');
30+
$dbh = pg_connect($conn_str);
31+
32+
pg_query($dbh, "DROP TABLE php_test");
33+
?>
3134
--EXPECT--
3235
===DONE===

ext/pgsql/tests/80_bug42783.phpt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ pg_insert($dbh, 'php_test', array());
2222

2323
var_dump(pg_fetch_assoc(pg_query($dbh, "SELECT * FROM php_test")));
2424

25-
pg_query($dbh, "DROP TABLE php_test");
2625
pg_close($dbh);
2726
?>
27+
--CLEAN--
28+
<?php
29+
require_once('inc/config.inc');
30+
$dbh = pg_connect($conn_str);
31+
32+
pg_query($dbh, "DROP TABLE php_test");
33+
?>
2834
--EXPECTF--
2935
array(2) {
3036
["id"]=>

ext/pgsql/tests/bug37100.phpt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ include 'inc/config.inc';
1515
$db = pg_connect($conn_str);
1616
@pg_query("SET bytea_output = 'escape'");
1717

18-
@pg_query('DROP TABLE test_bug');
19-
2018
pg_query('CREATE TABLE test_bug (binfield byteA) ;');
2119
pg_query("INSERT INTO test_bug VALUES (decode('0103AA000812','hex'))");
2220

@@ -35,12 +33,13 @@ var_dump(strlen($res));
3533
var_dump(bin2hex($res));
3634

3735
pg_close($db);
38-
36+
?>
37+
--CLEAN--
38+
<?php
39+
require_once('inc/config.inc');
3940
$db = pg_connect($conn_str);
40-
pg_query('DROP TABLE test_bug');
41-
pg_close($db);
42-
4341

42+
pg_query('DROP TABLE test_bug');
4443
?>
4544
--EXPECT--
4645
string(24) "\001\003\252\000\010\022"

ext/pgsql/tests/bug37100_9.phpt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ include 'inc/config.inc';
1414

1515
$db = pg_connect($conn_str);
1616

17-
@pg_query($db, 'DROP TABLE test_bug');
18-
1917
pg_query($db, 'CREATE TABLE test_bug (binfield byteA) ;');
2018
pg_query($db, "INSERT INTO test_bug VALUES (decode('0103AA000812','hex'))");
2119

@@ -36,10 +34,16 @@ var_dump(bin2hex($res));
3634
pg_close($db);
3735

3836
$db = pg_connect($conn_str);
39-
pg_query($db, 'DROP TABLE test_bug');
4037
pg_close($db);
4138

4239

40+
?>
41+
--CLEAN--
42+
<?php
43+
require_once('inc/config.inc');
44+
$db = pg_connect($conn_str);
45+
46+
pg_query($db, 'DROP TABLE test_bug');
4347
?>
4448
--EXPECT--
4549
string(14) "\x0103aa000812"

ext/pgsql/tests/bug47199.phpt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ require_once('inc/config.inc');
1313

1414
$dbh = pg_connect($conn_str);
1515
$tbl_name = 'test_47199';
16-
@pg_query($dbh, "DROP TABLE $tbl_name");
1716
pg_query($dbh, "CREATE TABLE $tbl_name (null_field INT, not_null_field INT NOT NULL)");
1817

1918
pg_insert($dbh, $tbl_name, array('null_field' => null, 'not_null_field' => 1));
@@ -31,11 +30,18 @@ echo $query, "\n";
3130

3231
var_dump(pg_fetch_all(pg_query($dbh, 'SELECT * FROM '. $tbl_name)));
3332

34-
@pg_query($dbh, "DROP TABLE $tbl_name");
3533
pg_close($dbh);
3634

3735
echo PHP_EOL."Done".PHP_EOL;
3836

37+
?>
38+
--CLEAN--
39+
<?php
40+
require_once('inc/config.inc');
41+
$dbh = pg_connect($conn_str);
42+
43+
$tbl_name = 'test_47199';
44+
pg_query($dbh, "DROP TABLE $tbl_name");
3945
?>
4046
--EXPECT--
4147
array(2) {

ext/pgsql/tests/bug68638.phpt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,15 @@ while ($row = pg_fetch_assoc($rs)) {
3030
var_dump($row);
3131
}
3232

33-
pg_query($conn, "DROP TABLE $table");
3433

34+
?>
35+
--CLEAN--
36+
<?php
37+
require_once('inc/config.inc');
38+
$conn = pg_connect($conn_str);
39+
$table='test_68638';
40+
41+
pg_query($conn, "DROP TABLE $table");
3542
?>
3643
--EXPECT--
3744
string(52) "UPDATE "test_68638" SET "value"=E'inf' WHERE "id"=1;"

ext/pgsql/tests/bug71062.phpt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ pg_convert($db, $table, ['test_field' => $date_string_modified_iso8601]);
3030

3131
print "done\n";
3232

33-
pg_query($db, "DROP TABLE $table");
34-
3533
?>
3634
==OK==
35+
--CLEAN--
36+
<?php
37+
require_once('inc/config.inc');
38+
$db = @pg_connect($conn_str);
39+
$table = "public.test_table_bug71062_bug71062";
40+
41+
pg_query($db, "DROP TABLE $table");
42+
?>
3743
--EXPECT--
3844
trying format Y-m-d\TH:i:sO
3945
trying format Y-m-d H:i:sO

0 commit comments

Comments
 (0)