Annotation of embedaddon/php/ext/sysvshm/tests/005.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: shm_get_var() tests
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("sysvshm")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: $key = ftok(__FILE__, 't');
! 9: $s = shm_attach($key, 1024);
! 10:
! 11: shm_put_var($s, -1, "test string");
! 12: shm_put_var($s, 0, new stdclass);
! 13: shm_put_var($s, 1, array(1,2,3));
! 14: shm_put_var($s, 2, false);
! 15: shm_put_var($s, 3, null);
! 16:
! 17: var_dump(shm_get_var());
! 18:
! 19: var_dump(shm_get_var(-1, -1));
! 20:
! 21: var_dump(shm_get_var($s, 1000));
! 22: var_dump(shm_get_var($s, -10000));
! 23:
! 24: var_dump(shm_get_var($s, array()));
! 25: var_dump(shm_get_var($s, -1));
! 26: var_dump(shm_get_var($s, 0));
! 27: var_dump(shm_get_var($s, 1));
! 28: var_dump(shm_get_var($s, 2));
! 29: var_dump(shm_get_var($s, 3));
! 30:
! 31: shm_put_var($s, 3, "test");
! 32: shm_put_var($s, 3, 1);
! 33: shm_put_var($s, 3, null);
! 34:
! 35: var_dump(shm_get_var($s, 3));
! 36: shm_remove($s);
! 37:
! 38: echo "Done\n";
! 39: ?>
! 40: --EXPECTF--
! 41:
! 42: Warning: shm_get_var() expects exactly 2 parameters, 0 given in %s005.php on line %d
! 43: NULL
! 44:
! 45: Warning: shm_get_var() expects parameter 1 to be resource, integer given in %s005.php on line %d
! 46: NULL
! 47:
! 48: Warning: shm_get_var(): variable key 1000 doesn't exist in %s005.php on line %d
! 49: bool(false)
! 50:
! 51: Warning: shm_get_var(): variable key -10000 doesn't exist in %s005.php on line %d
! 52: bool(false)
! 53:
! 54: Warning: shm_get_var() expects parameter 2 to be long, array given in %s005.php on line %d
! 55: NULL
! 56: string(11) "test string"
! 57: object(stdClass)#%d (0) {
! 58: }
! 59: array(3) {
! 60: [0]=>
! 61: int(1)
! 62: [1]=>
! 63: int(2)
! 64: [2]=>
! 65: int(3)
! 66: }
! 67: bool(false)
! 68: NULL
! 69: NULL
! 70: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>