Skip to content

Commit 0bfd8da

Browse files
Improve ext/pdo_pgsql tests cleanup
1 parent 8ef0e4c commit 0bfd8da

13 files changed

+82
-10
lines changed

ext/pdo_pgsql/tests/bug46274.phpt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@ var_dump($res->fetch());
6262

6363
// NULL
6464
var_dump($res->fetch());
65-
66-
$db->query('DROP TABLE test_one_blob_46274_1');
67-
65+
?>
66+
--CLEAN--
67+
<?php
68+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
69+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
70+
$db->query('DROP TABLE IF EXISTS test_one_blob_46274_1');
6871
?>
6972
--EXPECT--
7073
array(2) {

ext/pdo_pgsql/tests/bug46274_2.phpt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ var_dump(fread($x['blob1'], 10));
6565

6666
// NULL
6767
var_dump($res->fetch());
68-
69-
$db->query('DROP TABLE test_one_blob_46274_2');
70-
68+
?>
69+
--CLEAN--
70+
<?php
71+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
72+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
73+
$db->query('DROP TABLE IF EXISTS test_one_blob_46274_2');
7174
?>
7275
--EXPECTF--
7376
array(2) {

ext/pdo_pgsql/tests/bug66584.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ function run($pdo, $data)
5656
var_dump($stmt->fetchColumn());
5757
}
5858

59+
?>
60+
--CLEAN--
61+
<?php
62+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
63+
$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
64+
$pdo->query("DROP TABLE IF EXISTS b66584");
5965
?>
6066
--EXPECTF--
6167
int(3)

ext/pdo_pgsql/tests/bug67462.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ try {
2929
var_dump($pdo->beginTransaction());
3030
}
3131

32+
?>
33+
--CLEAN--
34+
<?php
35+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
36+
$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
37+
$pdo->query("DROP TABLE IF EXISTS b67462");
3238
?>
3339
--EXPECT--
3440
bool(true)

ext/pdo_pgsql/tests/bug70861.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ $stmt->execute();
4141

4242
fclose($f);
4343

44+
$db->exec('DROP TABLE test_blob_crash');
45+
4446
?>
4547
+++DONE+++
48+
--CLEAN--
49+
<?php
50+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
51+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
52+
$db->query('DROP TABLE IF EXISTS test_blob_crash_70861 CASCADE');
53+
?>
4654
--EXPECTF--
4755
%a
4856
+++DONE+++

ext/pdo_pgsql/tests/bug72633.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ var_dump($db->lastInsertId());
3434
*/
3535
var_dump($db->lastInsertId('test_last_id_72633_id_seq'));
3636

37-
$db->query('DROP TABLE test_last_id_72633');
38-
37+
?>
38+
--CLEAN--
39+
<?php
40+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
41+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
42+
$db->query('DROP TABLE IF EXISTS test_last_id_72633');
3943
?>
4044
--EXPECTREGEX--
4145
string\([0-9]*\)\ \"[0-9]*\"

ext/pdo_pgsql/tests/bug75402.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ if ($db) {
8484

8585
var_dump($resp);
8686
?>
87+
--CLEAN--
88+
<?php
89+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
90+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
91+
$db->exec('DROP TABLE IF EXISTS bug75402');
92+
?>
8793
--EXPECT--
8894
object(stdClass)#2 (1) {
8995
["entries"]=>

ext/pdo_pgsql/tests/bug_33876.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,20 @@ if (!$res->execute(array(false))) {
8989
print_r($res->fetchAll(PDO::FETCH_ASSOC));
9090
}
9191

92+
$db->exec('DROP TABLE test');
93+
9294
function normalizeErrorInfo(array $err): array {
9395
// Strip additional lines outputted by recent PgSQL versions
9496
$err[2] = trim(current(explode("\n", $err[2])));
9597
return $err;
9698
}
9799

100+
?>
101+
--CLEAN--
102+
<?php
103+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
104+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
105+
$db->query('DROP TABLE IF EXISTS b33876 CASCADE');
98106
?>
99107
--EXPECTF--
100108
Array

ext/pdo_pgsql/tests/bug_49985.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ for ($i = 0; $i < 3; $i++) {
3030
}
3131
}
3232

33+
?>
34+
--CLEAN--
35+
<?php
36+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
37+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
38+
$db->query('DROP TABLE IF EXISTS b49985 CASCADE');
3339
?>
3440
--EXPECTF--
3541
bool(true)

ext/pdo_pgsql/tests/copy_from.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ foreach (array($filename, $filenameWithDifferentNullValues, $filenameWithDiffere
127127
@unlink($f);
128128
}
129129
?>
130+
--CLEAN--
131+
<?php
132+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
133+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
134+
$db->query('DROP TABLE IF EXISTS test_copy_from CASCADE');
135+
?>
130136
--EXPECTF--
131137
Preparing test file and array for CopyFrom tests
132138
Testing pgsqlCopyFromArray() with default parameters

ext/pdo_pgsql/tests/copy_to.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ if(isset($filename)) {
8080
@unlink($filename);
8181
}
8282
?>
83+
--CLEAN--
84+
<?php
85+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
86+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
87+
$db->exec('DROP TABLE test_copy_to');
88+
?>
8389
--EXPECTF--
8490
Preparing test table for CopyTo tests
8591
Testing pgsqlCopyToArray() with default parameters

ext/pdo_pgsql/tests/is_in_transaction.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ var_dump($db->inTransaction());
5656
echo "Exception! at line ", $e->getLine(), "\n";
5757
var_dump($e->getMessage());
5858
}
59-
59+
?>
60+
--CLEAN--
61+
<?php
62+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
63+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
64+
$db->exec('DROP TABLE test_is_in_transaction');
6065
?>
6166
--EXPECT--
6267
Test PDO::PGSQL_TRANSACTION_INTRANS

ext/pdo_pgsql/tests/large_objects.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ echo "Fetched!\n";
7878
/* Now to remove the large object from the database, so it doesn't
7979
* linger and clutter up the storage */
8080
$db->pgsqlLOBUnlink($oid);
81-
81+
?>
82+
--CLEAN--
83+
<?php
84+
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
85+
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
86+
$db->exec('DROP TABLE test_large_objects');
8287
?>
8388
--EXPECT--
8489
Fetching:

0 commit comments

Comments
 (0)