Skip to content

Commit 185f146

Browse files
committed
Split tests/bug46247.phpt into 4 tests
This patch splits `tests/bug46247.phpt` into 4 tests so that we can check for different error messages depending on which PHP version we are running.
1 parent 933d389 commit 185f146

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

tests/bug46247.phpt renamed to tests/bug46247_001.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
--TEST--
22
Bug #46247 (ibase_set_event_handler() is allowing to pass callback without event)
33
--SKIPIF--
4-
<?php include("skipif.inc"); ?>
4+
<?php
5+
include("skipif.inc");
6+
include("skipif-php8-or-newer.inc");
7+
?>
58
--FILE--
69
<?php
710

tests/bug46247_002.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #46247 (ibase_set_event_handler() is allowing to pass callback without event)
3+
--SKIPIF--
4+
<?php include("skipif.inc"); ?>
5+
--FILE--
6+
<?php
7+
8+
require("interbase.inc");
9+
10+
$db = ibase_connect($test_base);
11+
12+
ibase_set_event_handler('foo', 1);
13+
ibase_set_event_handler($db, 'foo', 1);
14+
15+
?>
16+
--EXPECTF--
17+
Warning: ibase_set_event_handler(): Callback argument foo is not a callable function in %s on line %d
18+
19+
Warning: ibase_set_event_handler(): Callback argument foo is not a callable function in %s on line %d

tests/bug46247_003.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #46247 (ibase_set_event_handler() is allowing to pass callback without event)
3+
--SKIPIF--
4+
<?php
5+
include("skipif.inc");
6+
include("skipif-php7-or-older.inc");
7+
?>
8+
--FILE--
9+
<?php
10+
11+
require("interbase.inc");
12+
13+
$db = ibase_connect($test_base);
14+
15+
function test() { }
16+
17+
ibase_set_event_handler();
18+
19+
?>
20+
--EXPECTF--
21+
Fatal error: Uncaught ArgumentCountError: Wrong parameter count for ibase_set_event_handler() in %a

tests/bug46247_004.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #46247 (ibase_set_event_handler() is allowing to pass callback without event)
3+
--SKIPIF--
4+
<?php
5+
include("skipif.inc");
6+
include("skipif-php7-or-older.inc");
7+
?>
8+
--FILE--
9+
<?php
10+
11+
require("interbase.inc");
12+
13+
$db = ibase_connect($test_base);
14+
15+
function test() { }
16+
17+
ibase_set_event_handler(NULL, 'test', 1);
18+
19+
?>
20+
--EXPECTF--
21+
Fatal error: Uncaught TypeError: ibase_set_event_handler(): supplied argument is not a valid InterBase link resource in %a

0 commit comments

Comments
 (0)