Annotation of embedaddon/php/ext/standard/tests/file/fgetss.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: fgetss() tests
! 3: --FILE--
! 4: <?php
! 5:
! 6: $filename = dirname(__FILE__)."/fgetss.html";
! 7:
! 8: $array = array(
! 9: "askasdfasdf<b>aaaaaa\n</b>dddddd",
! 10: "asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
! 11: "aaa<script>function foo() {}</script>qqq",
! 12: "asdasd<a\n asdjeje",
! 13: "",
! 14: "some text \n<b>blah</i>",
! 15: "some another text <> hoho </>"
! 16: );
! 17:
! 18: foreach ($array as $str) {
! 19: file_put_contents($filename, $str);
! 20: $fp = fopen($filename, "r");
! 21: var_dump(fgetss($fp));
! 22: var_dump(fgetss($fp));
! 23: }
! 24:
! 25: foreach ($array as $str) {
! 26: file_put_contents($filename, $str);
! 27: $fp = fopen($filename, "r");
! 28: var_dump(fgetss($fp, 10));
! 29: var_dump(fgetss($fp, 10));
! 30: }
! 31:
! 32: var_dump(fgetss($fp, -10));
! 33: var_dump(fgetss($fp, 0));
! 34: fclose($fp);
! 35: var_dump(fgetss($fp, 0));
! 36:
! 37: @unlink($filename);
! 38:
! 39: echo "Done\n";
! 40: ?>
! 41: --EXPECTF--
! 42: string(18) "askasdfasdfaaaaaa
! 43: "
! 44: string(6) "dddddd"
! 45: string(6) "asdqw
! 46: "
! 47: string(8) "aaaaqqqq"
! 48: string(23) "aaafunction foo() {}qqq"
! 49: bool(false)
! 50: string(6) "asdasd"
! 51: string(0) ""
! 52: bool(false)
! 53: bool(false)
! 54: string(11) "some text
! 55: "
! 56: string(4) "blah"
! 57: string(24) "some another text hoho "
! 58: bool(false)
! 59: string(9) "askasdfas"
! 60: string(6) "dfaaaa"
! 61: string(5) "asdqw"
! 62: string(0) ""
! 63: string(3) "aaa"
! 64: string(7) "functio"
! 65: string(6) "asdasd"
! 66: string(0) ""
! 67: bool(false)
! 68: bool(false)
! 69: string(9) "some text"
! 70: string(2) "
! 71: "
! 72: string(9) "some anot"
! 73: string(9) "her text "
! 74:
! 75: Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
! 76: bool(false)
! 77:
! 78: Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
! 79: bool(false)
! 80:
! 81: Warning: fgetss(): %d is not a valid stream resource in %s on line %d
! 82: bool(false)
! 83: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>