xref: /PHP-5.5/ext/mysql/tests/mysql_close.phpt (revision b7091aaf)
1--TEST--
2mysql_close()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10include "connect.inc";
11
12$tmp    = NULL;
13$link   = NULL;
14
15if (false !== ($tmp = @mysql_close()))
16	printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
17
18if (NULL !== ($tmp = @mysql_close($link, $link)))
19	printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
20
21if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
22	printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
23		$host, $user, $db, $port, $socket);
24
25$tmp = @mysql_close(NULL);
26if (null !== $tmp)
27	printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
28
29$tmp = mysql_close($link);
30if (true !== $tmp)
31	printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
32
33if (false !== ($tmp = @mysql_query("SELECT 1", $link)))
34	printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
35
36print "done!\n";
37?>
38--EXPECTF--
39Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
40done!
41