Skip to content

Commit 8846048

Browse files
committed
Split tests/ibase_num_fields_001.phpt into 4 tests
This patch splits `tests/ibase_num_fields_001.phpt` into 4 tests so that we can check for different error messages depending on which PHP version we are running.
1 parent 97d40fe commit 8846048

File tree

4 files changed

+50
-9
lines changed

4 files changed

+50
-9
lines changed

tests/ibase_num_fields_001.phpt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ $x = ibase_connect($test_base);
1111

1212
var_dump(ibase_num_fields(ibase_query('SELECT * FROM test1')));
1313

14-
var_dump(ibase_num_fields(1));
15-
var_dump(ibase_num_fields());
16-
1714
?>
1815
--EXPECTF--
1916
int(2)
20-
21-
Warning: ibase_num_fields() expects parameter 1 to be resource, int given in %s on line %d
22-
NULL
23-
24-
Warning: ibase_num_fields() expects exactly 1 parameter, 0 given in %s on line %d
25-
NULL

tests/ibase_num_fields_002.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
ibase_num_fields(): Make sure passing an integer or zero args to the function emits a warning
3+
--SKIPIF--
4+
<?php
5+
include("skipif.inc");
6+
include("skipif-php8-or-newer.inc");
7+
?>
8+
--FILE--
9+
<?php
10+
11+
var_dump(ibase_num_fields(1));
12+
var_dump(ibase_num_fields());
13+
14+
?>
15+
--EXPECTF--
16+
Warning: ibase_num_fields() expects parameter 1 to be resource, int given in %s on line %d
17+
NULL
18+
19+
Warning: ibase_num_fields() expects exactly 1 parameter, 0 given in %s on line %d
20+
NULL

tests/ibase_num_fields_003.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
ibase_num_fields(): Make sure passing an integer to the function throws an error.
3+
--SKIPIF--
4+
<?php
5+
include("skipif.inc");
6+
include("skipif-php7-or-older.inc");
7+
?>
8+
--FILE--
9+
<?php
10+
11+
var_dump(ibase_num_fields(1));
12+
13+
?>
14+
--EXPECTF--
15+
Fatal error: Uncaught TypeError: ibase_num_fields(): Argument #1 ($query_result) must be of type resource, int given in %a

tests/ibase_num_fields_004.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
ibase_num_fields(): Make sure passing zero arguments to the function throws an error
3+
--SKIPIF--
4+
<?php
5+
include("skipif.inc");
6+
include("skipif-php7-or-older.inc");
7+
?>
8+
--FILE--
9+
<?php
10+
11+
var_dump(ibase_num_fields());
12+
13+
?>
14+
--EXPECTF--
15+
Fatal error: Uncaught ArgumentCountError: ibase_num_fields() expects exactly 1 argument, 0 given in %a

0 commit comments

Comments
 (0)