Annotation of embedaddon/php/ext/mysql/tests/mysql_stat.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: mysql_stat()
                      3: --SKIPIF--
                      4: <?php
                      5: require_once('skipif.inc');
                      6: require_once('skipifconnectfailure.inc');
                      7: ?>
                      8: --FILE--
                      9: <?php
                     10: include_once "connect.inc";
                     11: 
                     12: $dbname = 'test';
                     13: $tmp    = NULL;
                     14: $link   = NULL;
                     15: 
                     16: if (!is_null($tmp = @mysql_stat($link)))
                     17:        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
                     18: 
                     19: require('table.inc');
                     20: 
                     21: if (!is_null($tmp = @mysql_stat($link, "foo")))
                     22:        printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
                     23: 
                     24: if ((!is_string($stat = mysql_stat($link))) || ('' === $stat))
                     25:        printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n",
                     26:                gettype($stat), $stat, mysql_errno($link), mysql_error($link));
                     27: 
                     28: if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($stat)) {
                     29:        printf("[004] Expecting Unicode error message!\n");
                     30:        var_inspect($stat);
                     31: }
                     32: 
                     33: if ((!is_string($stat_def = mysql_stat())) || ('' === $stat_def))
                     34:        printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n",
                     35:                gettype($stat_def), $stat_def, mysql_errno(), mysql_error());
                     36: 
1.1.1.2 ! misho      37: assert(soundex($stat) === soundex($stat_def));
1.1       misho      38: 
                     39: mysql_close($link);
                     40: 
                     41: if (false !== ($tmp = mysql_stat($link)))
                     42:        printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
                     43: 
                     44: print "done!";
                     45: ?>
                     46: --EXPECTF--
                     47: Warning: mysql_stat(): %d is not a valid MySQL-Link resource in %s on line %d
1.1.1.2 ! misho      48: done!

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>