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