xref: /PHP-7.4/ext/pgsql/tests/bug64609.phpt (revision d679f022)
1--TEST--
2Bug #64609 (pg_convert enum type support)
3--SKIPIF--
4<?php
5include("skipif.inc");
6skip_server_version('8.3', '<');
7?>
8--FILE--
9<?php
10error_reporting(E_ALL);
11
12include 'config.inc';
13
14$db = pg_connect($conn_str);
15pg_query("BEGIN");
16pg_query("CREATE TYPE t_enum AS ENUM ('ok', 'ko')");
17pg_query("CREATE TABLE test_enum (a t_enum)");
18
19$fields = array('a' => 'ok');
20$converted = pg_convert($db, 'test_enum', $fields);
21
22pg_query("ROLLBACK");
23
24var_dump($converted);
25?>
26--EXPECT--
27array(1) {
28  [""a""]=>
29  string(5) "E'ok'"
30}
31