xref: /PHP-7.0/ext/mysqli/tests/mysqli_stat.phpt (revision eb0e09f5)
1--TEST--
2mysqli_stat()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifemb.inc');
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11	require_once("connect.inc");
12
13	$tmp    = NULL;
14	$link   = NULL;
15
16	if (!is_null($tmp = @mysqli_stat()))
17		printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
18
19	if (!is_null($tmp = @mysqli_stat($link)))
20		printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
21
22	require('table.inc');
23
24	if (!is_null($tmp = @mysqli_stat($link, "foo")))
25		printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
26
27	if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp))
28		printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n",
29			gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link));
30
31	mysqli_close($link);
32
33	if (!is_null($tmp = mysqli_stat($link)))
34		printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
35
36	print "done!";
37?>
38--EXPECTF--
39Warning: mysqli_stat(): Couldn't fetch mysqli in %s on line %d
40done!