com php-src: Add a test for bug 73498: ext/pgsql/tests/01createdb.phpt ext/pgsql/tests/06_bug73498.phpt ext/pgsql/ tests/9999dropdb.phpt
ext/pgsql/tests/config.inc
| From: | Anatol Belski | Date: | Mon, 21 Nov 2016 23:42:45 +0000 |
| Subject: | com php-src: Add a test for bug 73498: ext/pgsql/tests/01createdb.phpt ext/pgsql/tests/06_bug73498.phpt ext/pgsql/ tests/9999dropdb.phpt ext/pgsql/tests/config.inc |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95954@lists.php.net to get a copy of this message | ||
Commit: d36d4c70d3df2799af5dbb150660a70ffc60fc77
Author: Craig Duncan <git@duncanc.co.uk> Mon, 21 Nov 2016 19:49:18 +0000
Committer: Anatol Belski <ab@php.net> Tue, 22 Nov 2016 00:42:45 +0100
Parents: 850c1095ab6b7c988c4ba8a9182085abe56f211c
Branches: PHP-5.6 PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d36d4c70d3df2799af5dbb150660a70ffc60fc77
Log:
Add a test for bug 73498
Bugs:
https://bugs.php.net/73498
Changed paths:
M ext/pgsql/tests/01createdb.phpt
A ext/pgsql/tests/06_bug73498.phpt
M ext/pgsql/tests/9999dropdb.phpt
M ext/pgsql/tests/config.inc
Diff:
diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt
index 8f7a262..aa2e437 100644
--- a/ext/pgsql/tests/01createdb.phpt
+++ b/ext/pgsql/tests/01createdb.phpt
@@ -29,6 +29,9 @@ else {
echo pg_last_error()."\n";
}
+// Create view here
+pg_query($db,$view_def);
+
pg_close($db);
echo "OK";
diff --git a/ext/pgsql/tests/06_bug73498.phpt b/ext/pgsql/tests/06_bug73498.phpt
new file mode 100644
index 0000000..fdb2af2
--- /dev/null
+++ b/ext/pgsql/tests/06_bug73498.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug 73498 Incorrect DELIMITER syntax for pg_copy_to()
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+include('config.inc');
+
+$db = pg_connect($conn_str);
+
+$rows = pg_copy_to($db, "(select * from {$view_name})");
+
+var_dump(gettype($rows));
+var_dump(count($rows) > 0);
+
+?>
+--EXPECT--
+string(5) "array"
+bool(true)
diff --git a/ext/pgsql/tests/9999dropdb.phpt b/ext/pgsql/tests/9999dropdb.phpt
index 8cb178b..80502e5 100644
--- a/ext/pgsql/tests/9999dropdb.phpt
+++ b/ext/pgsql/tests/9999dropdb.phpt
@@ -9,6 +9,7 @@ PostgreSQL drop db
include('config.inc');
$db = pg_connect($conn_str);
+pg_query($db, "DROP VIEW {$view_name}");
pg_query($db, "DROP TABLE ".$table_name);
@pg_query($db, "DROP TABLE ".$table_name_92);
diff --git a/ext/pgsql/tests/config.inc b/ext/pgsql/tests/config.inc
index e9944de..98f099c 100644
--- a/ext/pgsql/tests/config.inc
+++ b/ext/pgsql/tests/config.inc
@@ -11,6 +11,10 @@ $table_name = "php_pgsql_test"; // test table that will
be created
$table_name_92 = "php_pgsql_test_92"; // test table that will be created
$num_test_record = 1000; // Number of records to create
+// Test view
+$view_name = "php_pgsql_viewtest";
+$view_def = "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name};";
+
// Test table
$table_def = "CREATE TABLE ${table_name} (num int, str text, bin bytea);";
$table_def_92 = "CREATE TABLE ${table_name_92} (textary text[], jsn json);";