From: Michael Wallner Date: Mon, 29 Apr 2013 12:24:05 +0000 (+0200) Subject: test X-Git-Tag: v0.3.0~3 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=commitdiff_plain;h=cd5d3cdafda1f9e9fe120c9eaf1269fdc577f04d test --- diff --git a/tests/types002.phpt b/tests/types002.phpt new file mode 100644 index 0000000..3de4400 --- /dev/null +++ b/tests/types002.phpt @@ -0,0 +1,126 @@ +--TEST-- +extended type support +--SKIPIF-- + +--FILE-- +exec("SET timezone TO UTC; SELECT +NULL as null, +true as bool, +1::int2 as int2, +2::int4 as int4, +3::int8 as int8, +1.1::float4 as float4, +2.2::float8 as float8, +'2013-01-01'::date as date, +1::abstime as abstime, +'2013-01-01 01:01:01'::timestamp as timestamp, +'2013-01-01 01:01:01 UTC'::timestamptz as timestamptz, +array[array[1,2,3],array[4,5,6],array[NULL::int,NULL::int,NULL::int]] as intarray +"); +var_dump($r->fetchRow(pq\Result::FETCH_ASSOC)); +?> +DONE +--EXPECTF-- +Test +array(12) { + ["null"]=> + NULL + ["bool"]=> + bool(true) + ["int2"]=> + int(1) + ["int4"]=> + int(2) + ["int8"]=> + int(3) + ["float4"]=> + float(1.1) + ["float8"]=> + float(2.2) + ["date"]=> + object(pq\DateTime)#%d (4) { + ["format"]=> + string(5) "Y-m-d" + ["date"]=> + string(19) "2013-01-01 00:00:00" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" + } + ["abstime"]=> + object(pq\DateTime)#%d (4) { + ["format"]=> + string(11) "Y-m-d H:i:s" + ["date"]=> + string(19) "1970-01-01 00:00:01" + ["timezone_type"]=> + int(1) + ["timezone"]=> + string(6) "+00:00" + } + ["timestamp"]=> + object(pq\DateTime)#%d (4) { + ["format"]=> + string(13) "Y-m-d H:i:s.u" + ["date"]=> + string(19) "2013-01-01 01:01:01" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" + } + ["timestamptz"]=> + object(pq\DateTime)#%d (4) { + ["format"]=> + string(14) "Y-m-d H:i:s.uO" + ["date"]=> + string(19) "2013-01-01 01:01:01" + ["timezone_type"]=> + int(1) + ["timezone"]=> + string(6) "+00:00" + } + ["intarray"]=> + array(3) { + [0]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } + [1]=> + array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) + } + [2]=> + array(3) { + [0]=> + NULL + [1]=> + NULL + [2]=> + NULL + } + } +} +DONE \ No newline at end of file