File tree Expand file tree Collapse file tree 9 files changed +166
-2
lines changed Expand file tree Collapse file tree 9 files changed +166
-2
lines changed Original file line number Diff line number Diff line change @@ -24,3 +24,13 @@ function test_use_after_ibase_free_query() {
2424 ibase_free_result ($ r );
2525 }
2626}
27+
28+ function test_ibase_trans_014_015 () {
29+ global $ test_base ;
30+
31+ $ x = ibase_connect ($ test_base );
32+ var_dump (ibase_trans ($ x ));
33+ var_dump (ibase_trans (1 ));
34+ var_dump (ibase_close ());
35+ var_dump (ibase_close ($ x ));
36+ }
Original file line number Diff line number Diff line change @@ -137,6 +137,27 @@ function skip_if_fbclient_lt($v) {
137137 if (($ cv = ibase_get_client_version ()) < $ v )die ("skip Firebird client library version $ cv < $ v " );
138138}
139139
140+ function skip_if_ext_lt (int $ v ): void {
141+ if (!defined ('IBASE_VER ' ))die ("Skip IBASE_VER not defined " );
142+ if (IBASE_VER < $ v )die ("Skip IBASE_VER " .IBASE_VER ." < $ v " );
143+ }
144+
145+ function skip_if_ext_gte (int $ v ): void {
146+ if (defined ('IBASE_VER ' )) {
147+ if (IBASE_VER >= $ v )die ("Skip IBASE_VER " .IBASE_VER ." >= $ v " );
148+ }
149+ }
150+
151+ function skip_if_php_lt (float $ v ): void {
152+ $ cv = (float )PHP_MAJOR_VERSION .". " .PHP_MINOR_VERSION ;
153+ if ($ cv < $ v )die ("skip PHP version $ cv < $ v " );
154+ }
155+
156+ function skip_if_php_gte (float $ v ): void {
157+ $ cv = (float )PHP_MAJOR_VERSION .". " .PHP_MINOR_VERSION ;
158+ if ($ cv >= $ v )die ("skip PHP version $ cv >= $ v " );
159+ }
160+
140161function ibase_query_bulk (array $ queries , $ tr = null ) {
141162 foreach ($ queries as $ q ){
142163 if (is_array ($ q )){
Original file line number Diff line number Diff line change 11--TEST--
22ibase_close(): Basic test
33--SKIPIF--
4- <?php include ("skipif.inc " ); ?>
4+ <?php
5+
6+ include ("skipif.inc " );
7+
8+ // See also: tests/ibase_close_004.phpt
9+ skip_if_ext_gte (61 );
10+
11+ ?>
512--FILE--
613<?php
714
Original file line number Diff line number Diff line change 22ibase_close(): Make sure passing a string to the function throws an error.
33--SKIPIF--
44<?php
5+
56include ("skipif.inc " );
67include ("skipif-php7-or-older.inc " );
8+
9+ // See also: tests/ibase_close_005.phpt
10+ skip_if_ext_gte (61 );
711?>
812--FILE--
913<?php
Original file line number Diff line number Diff line change 1+ --TEST--
2+ ibase_close(): Basic test
3+ --SKIPIF--
4+ <?php
5+
6+ include ("skipif.inc " );
7+
8+ // See also: tests/ibase_close_001.phpt
9+ skip_if_ext_lt (61 );
10+
11+ ?>
12+ --FILE--
13+ <?php
14+
15+ require ("interbase.inc " );
16+
17+ set_exception_handler ("php_ibase_exception_handler " );
18+
19+ $ x = ibase_connect ($ test_base );
20+ var_dump (ibase_close ($ x ));
21+ var_dump (ibase_close ($ x ));
22+ var_dump (ibase_close ());
23+
24+ ?>
25+ --EXPECT--
26+ bool(true)
27+ Fatal error: Uncaught TypeError: ibase_close(): supplied resource is not a valid Firebird/InterBase link resource
Original file line number Diff line number Diff line change 1+ --TEST--
2+ ibase_close(): Make sure passing a string to the function throws an error.
3+ --SKIPIF--
4+ <?php
5+
6+ include ("skipif.inc " );
7+ include ("skipif-php7-or-older.inc " );
8+
9+ // See also: tests/ibase_close_003.phpt
10+ skip_if_ext_lt (61 );
11+
12+ ?>
13+ --FILE--
14+ <?php
15+
16+ require ("interbase.inc " );
17+
18+ set_exception_handler ("php_ibase_exception_handler " );
19+
20+ $ x = ibase_connect ($ test_base );
21+ var_dump (ibase_close ($ x ));
22+ var_dump (ibase_close ($ x ));
23+ var_dump (ibase_close ());
24+ var_dump (ibase_close ('foo ' ));
25+
26+ ?>
27+ --EXPECT--
28+ bool(true)
29+ Fatal error: Uncaught TypeError: ibase_close(): supplied resource is not a valid Firebird/InterBase link resource
Original file line number Diff line number Diff line change 11--TEST--
22ibase_trans(): Basic test
33--SKIPIF--
4- <?php include ("skipif.inc " ); ?>
4+ <?php
5+
6+ include ("skipif.inc " );
7+
8+ // See also tests/ibase_trans_014.phpt
9+ // See also tests/ibase_trans_015.phpt
10+ skip_if_ext_gte (61 );
11+
12+ ?>
513--FILE--
614<?php
715
Original file line number Diff line number Diff line change 1+ --TEST--
2+ ibase_trans(): Basic test
3+ --SKIPIF--
4+ <?php
5+
6+ include ("skipif.inc " );
7+
8+ // See also tests/ibase_trans_001.phpt
9+ // See also tests/ibase_trans_015.phpt
10+ skip_if_ext_lt (61 );
11+ skip_if_php_lt (8 );
12+
13+ ?>
14+ --FILE--
15+ <?php
16+
17+ require ("interbase.inc " );
18+ require ("common.inc " );
19+
20+ set_exception_handler ("php_ibase_exception_handler " );
21+
22+ test_ibase_trans_014_015 ();
23+
24+ ?>
25+ --EXPECTF--
26+ resource(%d) of type (Firebird/InterBase transaction)
27+ resource(%d) of type (Firebird/InterBase transaction)
28+ bool(true)
29+ Fatal error: Uncaught TypeError: ibase_close(): supplied resource is not a valid Firebird/InterBase link resource
Original file line number Diff line number Diff line change 1+ --TEST--
2+ ibase_trans(): Basic test
3+ --SKIPIF--
4+ <?php
5+
6+ include ("skipif.inc " );
7+
8+ // See also tests/ibase_trans_001.phpt
9+ // See also tests/ibase_trans_014.phpt
10+ skip_if_ext_lt (61 );
11+ skip_if_php_gte (8 );
12+
13+ ?>
14+ --FILE--
15+ <?php
16+
17+ require ("interbase.inc " );
18+ require ("common.inc " );
19+
20+ test_ibase_trans_014_015 ();
21+
22+ ?>
23+ --EXPECTF--
24+ resource(%d) of type (Firebird/InterBase transaction)
25+ resource(%d) of type (Firebird/InterBase transaction)
26+ bool(true)
27+
28+ Warning: ibase_close(): supplied resource is not a valid Firebird/InterBase link resource%s
29+ bool(false)
You can’t perform that action at this time.
0 commit comments