diff options
author | Felix De Vliegher <felixdv@php.net> | 2008-09-15 08:51:43 +0000 |
---|---|---|
committer | Felix De Vliegher <felixdv@php.net> | 2008-09-15 08:51:43 +0000 |
commit | 7251de9eb807f80c927e477b7145971d5d52cfb0 (patch) | |
tree | a209ad3857ca1201e876fdd817e5552c5ce8b0da | |
parent | 52695ff9396bdb50acaba5a68964533eb975f69b (diff) | |
download | php-git-7251de9eb807f80c927e477b7145971d5d52cfb0.tar.gz |
MFH: More fileinfo tests.
-rw-r--r-- | ext/fileinfo/tests/finfo_close_error.phpt | 45 | ||||
-rw-r--r-- | ext/fileinfo/tests/finfo_phpinfo_basic.phpt | 19 |
2 files changed, 64 insertions, 0 deletions
diff --git a/ext/fileinfo/tests/finfo_close_error.phpt b/ext/fileinfo/tests/finfo_close_error.phpt new file mode 100644 index 0000000000..0294a250d5 --- /dev/null +++ b/ext/fileinfo/tests/finfo_close_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test finfo_close() function : error conditions +--FILE-- +<?php +/* Prototype : resource finfo_close(resource finfo) + * Description: Close fileinfo resource. + * Source code: ext/fileinfo/fileinfo.c + * Alias to functions: + */ + +echo "*** Testing finfo_close() : error conditions ***\n"; + +$magicFile = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'magic'; +$finfo = finfo_open( FILEINFO_MIME, $magicFile ); +$fp = fopen( __FILE__, 'r' ); + +echo "\n-- Testing finfo_close() function with Zero arguments --\n"; +var_dump( finfo_close() ); + +echo "\n-- Testing finfo_close() function with more than expected no. of arguments --\n"; +var_dump( finfo_close( $finfo, '10') ); + +echo "\n-- Testing finfo_close() function with wrong resource type --\n"; +var_dump( finfo_close( $fp ) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing finfo_close() : error conditions *** + +-- Testing finfo_close() function with Zero arguments -- + +Warning: finfo_close() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing finfo_close() function with more than expected no. of arguments -- + +Warning: finfo_close() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) + +-- Testing finfo_close() function with wrong resource type -- + +Warning: finfo_close(): supplied resource is not a valid file_info resource in %s on line %d +bool(false) +===DONE=== diff --git a/ext/fileinfo/tests/finfo_phpinfo_basic.phpt b/ext/fileinfo/tests/finfo_phpinfo_basic.phpt new file mode 100644 index 0000000000..9f1c2cc14d --- /dev/null +++ b/ext/fileinfo/tests/finfo_phpinfo_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test finfo extention : loading into phpinfo() +--FILE-- +<?php + +echo "*** Testing finfo extension : loading info phpinfo() ***\n"; + +ob_start(); +echo phpinfo(8); +$output = ob_get_clean(); + +var_dump(preg_match("/fileinfo support => enabled/", $output)); + +?> +===DONE=== +--EXPECTF-- +*** Testing finfo extension : loading info phpinfo() *** +int(1) +===DONE=== |