From: Raghubansh Kumar Date: Mon, 18 Jun 2007 19:51:11 +0000 (+0000) Subject: New tests for file system handling functions X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~421 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0465ee4006ebf25c2ed47429e59e529447d67b7a;p=php New tests for file system handling functions --- diff --git a/ext/standard/tests/file/filesize_basic.phpt b/ext/standard/tests/file/filesize_basic.phpt new file mode 100644 index 0000000000..0007f0b6bf --- /dev/null +++ b/ext/standard/tests/file/filesize_basic.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test filesize() function: basic functionaity +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing size of files and directories with filesize() *** +int(%d) +int(%d) +int(0) +*** Done *** + +--UEXPECTF-- +*** Testing size of files and directories with filesize() *** +int(%d) +int(%d) +int(0) +*** Done *** diff --git a/ext/standard/tests/file/filesize_error.phpt b/ext/standard/tests/file/filesize_error.phpt new file mode 100644 index 0000000000..e928eb2f10 --- /dev/null +++ b/ext/standard/tests/file/filesize_error.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test filesize() function: error conditions +--FILE-- + +--EXPECTF-- +*** Testing filesize(): error conditions *** +Warning: filesize(): stat failed for /no/such/file in %s on line %d +bool(false) + +Warning: filesize(): stat failed for /no/such/dir in %s on line %d +bool(false) + +Warning: filesize() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: filesize() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +*** Done *** + +--UEXPECTF-- +*** Testing filesize(): error conditions *** +Warning: filesize(): stat failed for /no/such/file in %s on line %d +bool(false) + +Warning: filesize(): stat failed for /no/such/dir in %s on line %d +bool(false) + +Warning: filesize() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: filesize() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +*** Done *** diff --git a/ext/standard/tests/file/fread_basic.phpt b/ext/standard/tests/file/fread_basic.phpt new file mode 100644 index 0000000000..2e946d3316 --- /dev/null +++ b/ext/standard/tests/file/fread_basic.phpt @@ -0,0 +1,1179 @@ +--TEST-- +Test fread() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing fread() basic operations *** + +-- Testing fread) with file having data of type numeric -- +-- File opened in mode r -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode rb -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode rt -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode r+ -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode r+b -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode r+t -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) + +-- Testing fread) with file having data of type text -- +-- File opened in mode r -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode rb -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode rt -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode r+ -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode r+b -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode r+t -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) + +-- Testing fread) with file having data of type text_with_new_line -- +-- File opened in mode r -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode rb -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode rt -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode r+ -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode r+b -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode r+t -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) + +-- Testing fread) with file having data of type alphanumeric -- +-- File opened in mode r -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode rb -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode rt -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode r+ -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode r+b -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode r+t -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +Done +--UEXPECTF-- +*** Testing fread() basic operations *** + +-- Testing fread) with file having data of type numeric -- +-- File opened in mode r -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode rb -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode rt -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode r+ -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode r+b -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) +-- File opened in mode r+t -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "950b7457d1deb6332f2fc5d42f3129d6" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "4501f99f2b79d0345f26f1394aca58a3" +bool(true) + +-- Testing fread) with file having data of type text -- +-- File opened in mode r -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode rb -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode rt -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode r+ -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode r+b -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) +-- File opened in mode r+t -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "e486000c4c8452774f746a27658d87fa" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +bool(true) + +-- Testing fread) with file having data of type text_with_new_line -- +-- File opened in mode r -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode rb -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode rt -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode r+ -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode r+b -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) +-- File opened in mode r+t -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "b09c8026a64a88d36d4c2f17983964bb" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a148fa8110bbac875d84fc9d7056c0a1" +bool(true) + +-- Testing fread) with file having data of type alphanumeric -- +-- File opened in mode r -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode rb -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode rt -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode r+ -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode r+b -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +-- File opened in mode r+t -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +unicode(32) "3fabd48d8eaa65c14e0d93d6880c560c" +bool(true) +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +unicode(32) "a49d752f980184c7f44568e930f89c72" +bool(true) +Done diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt new file mode 100644 index 0000000000..fdf64328eb --- /dev/null +++ b/ext/standard/tests/file/fread_error.phpt @@ -0,0 +1,169 @@ +--TEST-- +Test fread() function : error conditions +--FILE-- + +--CLEAN-- + + +--EXPECTF-- +*** Testing is_dir(): basic functionality *** +bool(true) +bool(true) +bool(false) +bool(true) +*** Testing is_dir() for its return value type *** +bool(true) +bool(true) +*** Done *** +--UEXPECTF-- +*** Testing is_dir(): basic functionality *** +bool(true) +bool(true) +bool(false) +bool(true) +*** Testing is_dir() for its return value type *** +bool(true) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/is_dir_error.phpt b/ext/standard/tests/file/is_dir_error.phpt new file mode 100644 index 0000000000..b23d21f8d9 --- /dev/null +++ b/ext/standard/tests/file/is_dir_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test is_dir() function: error conditions +--FILE-- + expected no.of args + +/* Non-existing dir */ +var_dump( is_dir("/no/such/dir") ); + +echo "*** Done ***"; +?> + +--CLEAN-- + +--EXPECTF-- +*** Testing is_dir() error conditions *** +Warning: is_dir() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: is_dir() expects exactly 1 parameter, 2 given in %s on line %d +NULL +bool(false) +*** Done *** +--UEXPECTF-- +*** Testing is_dir() error conditions *** +Warning: is_dir() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: is_dir() expects exactly 1 parameter, 2 given in %s on line %d +NULL +bool(false) +*** Done *** diff --git a/ext/standard/tests/file/is_file_basic.phpt b/ext/standard/tests/file/is_file_basic.phpt new file mode 100644 index 0000000000..930a49db0f --- /dev/null +++ b/ext/standard/tests/file/is_file_basic.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test is_file() function: basic functionality +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing is_file(): basic functionality *** +bool(true) +bool(false) +bool(false) +bool(true) +*** Testing is_file() for its return value type *** +bool(true) +bool(true) + +*** Done *** +--UEXPECTF-- +*** Testing is_file(): basic functionality *** +bool(true) +bool(false) +bool(false) +bool(true) +*** Testing is_file() for its return value type *** +bool(true) +bool(true) + +*** Done *** diff --git a/ext/standard/tests/file/is_file_error.phpt b/ext/standard/tests/file/is_file_error.phpt new file mode 100644 index 0000000000..bb8b644e4d --- /dev/null +++ b/ext/standard/tests/file/is_file_error.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test is_file() function: error conditions +--FILE-- + expected */ +$file_handle = fopen($file_path."/is_file_error.tmp", "w"); +var_dump( is_file( $file_path."/is_file_error.tmp", $file_path."/is_file_error1.tmp") ); + +/* Non-existing file */ +var_dump( is_file($file_path."/is_file_error1.tmp") ); + +/* Passing resource as an argument */ +var_dump( is_file($file_handle) ); + +fclose($file_handle); + +echo "\n*** Done ***"; +?> + +--CLEAN-- + +--EXPECTF-- +*** Testing is_file() error conditions *** +Warning: is_file() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: is_file() expects exactly 1 parameter, 2 given in %s on line %d +NULL +bool(false) + +Warning: is_file() expects parameter 1 to be string (Unicode or binary), resource given in %s on line %d +NULL + +*** Done *** +--UEXPECTF-- +*** Testing is_file() error conditions *** +Warning: is_file() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: is_file() expects exactly 1 parameter, 2 given in %s on line %d +NULL +bool(false) + +Warning: is_file() expects parameter 1 to be string (Unicode or binary), resource given in %s on line %d +NULL + +*** Done ***