Annotation of embedaddon/php/ext/mysql/tests/mysql_tablename.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: mysql_tablename()
        !             3: --SKIPIF--
        !             4: <?php
        !             5: require_once('skipif.inc');
        !             6: require_once('skipifconnectfailure.inc');
        !             7: ?>
        !             8: --FILE--
        !             9: <?php
        !            10: include "connect.inc";
        !            11: 
        !            12: $tmp    = NULL;
        !            13: $link   = NULL;
        !            14: 
        !            15: if (!is_null($tmp = @mysql_tablename()))
        !            16:        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
        !            17: 
        !            18: if (null !== ($tmp = @mysql_tablename($link)))
        !            19:        printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
        !            20: 
        !            21: require('table.inc');
        !            22: if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 2", $link)) {
        !            23:        printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
        !            24: }
        !            25: 
        !            26: if (NULL !== ($tmp = mysql_tablename($res)))
        !            27:        printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
        !            28: 
        !            29: if (false !== ($tmp = mysql_tablename($res, -1)))
        !            30:        printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
        !            31: 
        !            32: var_dump(mysql_tablename($res, 0));
        !            33: 
        !            34: if (false !== ($tmp = mysql_tablename($res, 2)))
        !            35:        printf("[00%d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
        !            36: 
        !            37: mysql_free_result($res);
        !            38: 
        !            39: var_dump(mysql_tablename($res, 0));
        !            40: 
        !            41: mysql_close($link);
        !            42: print "done!";
        !            43: ?>
        !            44: --EXPECTF--
        !            45: Warning: mysql_tablename() expects at least 2 parameters, 1 given in %s on line %d
        !            46: 
        !            47: Warning: mysql_tablename(): Unable to jump to row -1 on MySQL result index %d in %s on line %d
        !            48: %unicode|string%(1) "1"
        !            49: 
        !            50: Warning: mysql_tablename(): Unable to jump to row 2 on MySQL result index %d in %s on line %d
        !            51: 
        !            52: Warning: mysql_tablename(): %d is not a valid MySQL result resource in %s on line %d
        !            53: bool(false)
        !            54: done!

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