xref: /php-src/ext/mysqli/tests/001.phpt (revision 6a4031b8)
1--TEST--
2mysqli connect
3--EXTENSIONS--
4mysqli
5--CONFLICTS--
6mysqli
7--SKIPIF--
8<?php
9require_once 'skipifconnectfailure.inc';
10?>
11--FILE--
12<?php
13// TODO Not conflicting with parallel?
14    require_once("connect.inc");
15
16    $test = "";
17
18    /*** test mysqli_connect localhost:port ***/
19    $link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket);
20    $test .= ($link) ? "1" : "0";
21    mysqli_close($link);
22
23    /*** test mysqli_real_connect ***/
24    $link = mysqli_init();
25    $test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) )
26        ? "1" : "0";
27    mysqli_close($link);
28
29    /*** test mysqli_real_connect with db ***/
30    $link = mysqli_init();
31    $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
32        ? "1" : "0";
33    mysqli_close($link);
34
35    /*** test mysqli_real_connect with port ***/
36    $link = mysqli_init();
37    $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
38        ? "1":"0";
39    mysqli_close($link);
40
41    /* temporary addition for Kent's setup, Win32 box */
42    for ($i = 0; $i < 10; $i++) {
43        if (!$link = mysqli_init())
44            printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
45
46        if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
47            printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
48
49        mysqli_close($link);
50    }
51
52    /*** test mysqli_real_connect compressed ***/
53    /*
54    $link = mysqli_init();
55    $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS))
56        ? "1" : "0";
57    mysqli_close($link);
58  */
59    /* todo ssl connections */
60
61    var_dump($test);
62    print "done!";
63?>
64--EXPECTF--
65%s(4) "1111"
66done!
67