Annotation of embedaddon/php/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: new mysqli()
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifemb.inc');
! 7: require_once('skipifconnectfailure.inc');
! 8: if (!get_current_user())
! 9: die('skip: get_current_user() not supported');
! 10: if (stristr(mysqli_get_client_info(), 'mysqlnd'))
! 11: die("skip: test for libmysql (different error output when using php streams");
! 12: ?>
! 13: --FILE--
! 14: <?php
! 15: require_once("connect.inc");
! 16:
! 17: $myhost = 'invalidhost';
! 18: $link = NULL;
! 19:
! 20: print "1) bail\n";
! 21: if (!is_object($mysqli = new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
! 22: printf("[001] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
! 23:
! 24: print "2) be quiet\n";
! 25: if (!is_object($mysqli = @new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
! 26: printf("[002] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
! 27: var_dump(mysqli_connect_error());
! 28: var_dump(mysqli_connect_errno());
! 29:
! 30: print "3) bail\n";
! 31: if (false !== ($link = mysqli_connect($myhost))) {
! 32: printf("[003] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
! 33: }
! 34:
! 35: print "4) be quiet\n";
! 36: if (false !== ($link = @mysqli_connect($myhost))) {
! 37: printf("[004] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
! 38: }
! 39: var_dump(mysqli_connect_error());
! 40: var_dump(mysqli_connect_errno());
! 41:
! 42: print "done!";
! 43: ?>
! 44: --EXPECTF--
! 45: 1) bail
! 46:
! 47: Warning: mysqli::mysqli(): (HY000/200%d): %s
! 48: 2) be quiet
! 49: %s(%d) "%s"
! 50: int(200%d)
! 51: 3) bail
! 52:
! 53: Warning: mysqli_connect(): (HY000/200%d): %s
! 54: 4) be quiet
! 55: %s(%d) "%s"
! 56: int(200%d)
! 57: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>