mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/pdo_pgsql: Improve tests cleanup (#11855)
This commit is contained in:
committed by
GitHub
parent
82934746b7
commit
4f84b159b9
@@ -21,7 +21,6 @@ try {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS test_one_blob_46274_1 CASCADE');
|
||||
$db->query('CREATE TABLE test_one_blob_46274_1 (id SERIAL NOT NULL, blob1 BYTEA)');
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO test_one_blob_46274_1 (blob1) VALUES (:foo)");
|
||||
@@ -62,9 +61,12 @@ var_dump($res->fetch());
|
||||
|
||||
// NULL
|
||||
var_dump($res->fetch());
|
||||
|
||||
$db->query('DROP TABLE test_one_blob_46274_1');
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->query('DROP TABLE IF EXISTS test_one_blob_46274_1');
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
|
||||
@@ -21,7 +21,6 @@ try {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS test_one_blob_46274_2 CASCADE');
|
||||
$db->query('CREATE TABLE test_one_blob_46274_2 (id SERIAL NOT NULL, blob1 BYTEA)');
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO test_one_blob_46274_2 (blob1) VALUES (:foo)");
|
||||
@@ -65,9 +64,12 @@ var_dump(fread($x['blob1'], 10));
|
||||
|
||||
// NULL
|
||||
var_dump($res->fetch());
|
||||
|
||||
$db->query('DROP TABLE test_one_blob_46274_2');
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->query('DROP TABLE IF EXISTS test_one_blob_46274_2');
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
|
||||
@@ -56,6 +56,12 @@ function run($pdo, $data)
|
||||
var_dump($stmt->fetchColumn());
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$pdo->query("DROP TABLE IF EXISTS b66584");
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(3)
|
||||
|
||||
@@ -29,6 +29,12 @@ try {
|
||||
var_dump($pdo->beginTransaction());
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$pdo->query("DROP TABLE IF EXISTS b67462");
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
|
||||
@@ -21,7 +21,6 @@ try {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS test_blob_crash_70861 CASCADE');
|
||||
$db->query('CREATE TABLE test_blob_crash_70861 (id SERIAL NOT NULL, blob1 BYTEA)');
|
||||
|
||||
class HelloWrapper {
|
||||
@@ -41,8 +40,16 @@ $stmt->execute();
|
||||
|
||||
fclose($f);
|
||||
|
||||
$db->exec('DROP TABLE test_blob_crash');
|
||||
|
||||
?>
|
||||
+++DONE+++
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->query('DROP TABLE IF EXISTS test_blob_crash_70861 CASCADE');
|
||||
?>
|
||||
--EXPECTF--
|
||||
%a
|
||||
+++DONE+++
|
||||
|
||||
@@ -18,7 +18,6 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
|
||||
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS test_last_id_72633 CASCADE');
|
||||
$db->query('CREATE TABLE test_last_id_72633 (id SERIAL NOT NULL, field1 VARCHAR(10))');
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO test_last_id_72633 (field1) VALUES ('test')");
|
||||
@@ -34,8 +33,12 @@ var_dump($db->lastInsertId());
|
||||
*/
|
||||
var_dump($db->lastInsertId('test_last_id_72633_id_seq'));
|
||||
|
||||
$db->query('DROP TABLE test_last_id_72633');
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->query('DROP TABLE IF EXISTS test_last_id_72633');
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
string\([0-9]*\)\ \"[0-9]*\"
|
||||
|
||||
@@ -17,7 +17,6 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$resp = new \stdClass();
|
||||
$resp->entries = [];
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS bug75402 CASCADE');
|
||||
$db->query('CREATE TABLE bug75402 (
|
||||
"id" character varying(64) NOT NULL,
|
||||
"group_id" character varying(64) NOT NULL,
|
||||
@@ -84,6 +83,12 @@ if ($db) {
|
||||
|
||||
var_dump($resp);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->exec('DROP TABLE IF EXISTS bug75402');
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#2 (1) {
|
||||
["entries"]=>
|
||||
|
||||
@@ -16,7 +16,6 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
|
||||
|
||||
$db->exec("SET LC_MESSAGES='C'");
|
||||
$db->query('DROP TABLE IF EXISTS b33876 CASCADE');
|
||||
$db->exec('CREATE TABLE b33876 (foo varchar(5) NOT NULL, bar bool NOT NULL)');
|
||||
$db->exec("INSERT INTO b33876 VALUES('false','f')");
|
||||
$db->exec("INSERT INTO b33876 VALUES('true', 't')");
|
||||
@@ -95,6 +94,12 @@ function normalizeErrorInfo(array $err): array {
|
||||
return $err;
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->query('DROP TABLE IF EXISTS b33876 CASCADE');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Array
|
||||
|
||||
@@ -15,7 +15,6 @@ require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS b49985 CASCADE');
|
||||
$db->exec("CREATE TABLE b49985 (a int PRIMARY KEY)");
|
||||
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
@@ -30,6 +29,12 @@ for ($i = 0; $i < 3; $i++) {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->query('DROP TABLE IF EXISTS b49985 CASCADE');
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
@@ -16,7 +16,6 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS test_copy_from CASCADE');
|
||||
$db->exec('CREATE TABLE test_copy_from (a integer not null primary key, b text, c integer)');
|
||||
|
||||
echo "Preparing test file and array for CopyFrom tests\n";
|
||||
@@ -127,6 +126,12 @@ foreach (array($filename, $filenameWithDifferentNullValues, $filenameWithDiffere
|
||||
@unlink($f);
|
||||
}
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->query('DROP TABLE IF EXISTS test_copy_from CASCADE');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Preparing test file and array for CopyFrom tests
|
||||
Testing pgsqlCopyFromArray() with default parameters
|
||||
|
||||
@@ -16,7 +16,6 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS test_copy_to CASCADE');
|
||||
$db->exec('CREATE TABLE test_copy_to (a integer not null primary key, b text, c integer)');
|
||||
|
||||
$db->beginTransaction();
|
||||
@@ -80,6 +79,12 @@ if(isset($filename)) {
|
||||
@unlink($filename);
|
||||
}
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->exec('DROP TABLE test_copy_to');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Preparing test table for CopyTo tests
|
||||
Testing pgsqlCopyToArray() with default parameters
|
||||
|
||||
@@ -16,7 +16,6 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS test_is_in_transaction CASCADE');
|
||||
$db->exec('CREATE TABLE test_is_in_transaction (a integer not null primary key, b text)');
|
||||
|
||||
$db->beginTransaction();
|
||||
@@ -56,7 +55,12 @@ var_dump($db->inTransaction());
|
||||
echo "Exception! at line ", $e->getLine(), "\n";
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->exec('DROP TABLE test_is_in_transaction');
|
||||
?>
|
||||
--EXPECT--
|
||||
Test PDO::PGSQL_TRANSACTION_INTRANS
|
||||
|
||||
@@ -16,7 +16,6 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
|
||||
|
||||
$db->query('DROP TABLE IF EXISTS test_large_objects CASCADE');
|
||||
$db->exec('CREATE TABLE test_large_objects (blobid integer not null primary key, bloboid OID)');
|
||||
|
||||
$db->beginTransaction();
|
||||
@@ -78,7 +77,12 @@ echo "Fetched!\n";
|
||||
/* Now to remove the large object from the database, so it doesn't
|
||||
* linger and clutter up the storage */
|
||||
$db->pgsqlLOBUnlink($oid);
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->exec('DROP TABLE test_large_objects');
|
||||
?>
|
||||
--EXPECT--
|
||||
Fetching:
|
||||
|
||||
Reference in New Issue
Block a user