diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/mcrypt/tests/mcrypt_ecb_error.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/mcrypt/tests/mcrypt_ecb_error.phpt')
-rw-r--r-- | ext/mcrypt/tests/mcrypt_ecb_error.phpt | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/ext/mcrypt/tests/mcrypt_ecb_error.phpt b/ext/mcrypt/tests/mcrypt_ecb_error.phpt new file mode 100644 index 0000000..b33034a --- /dev/null +++ b/ext/mcrypt/tests/mcrypt_ecb_error.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test mcrypt_ecb() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("mcrypt")) { + print "skip - mcrypt extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv) + * Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv + * Source code: ext/mcrypt/mcrypt.c + * Alias to functions: + */ + +echo "*** Testing mcrypt_ecb() : error conditions ***\n"; + + +//Test mcrypt_ecb with one more than the expected number of arguments +echo "\n-- Testing mcrypt_ecb() function with more than expected no. of arguments --\n"; +$cipher = 10; +$key = 'string_val'; +$data = 'string_val'; +$mode = 10; +$iv = 'string_val'; +$extra_arg = 10; +var_dump( mcrypt_ecb($cipher, $key, $data, $mode, $iv, $extra_arg) ); + +// Testing mcrypt_ecb with one less than the expected number of arguments +echo "\n-- Testing mcrypt_ecb() function with less than expected no. of arguments --\n"; +$cipher = 10; +$key = 'string_val'; +$data = 'string_val'; +var_dump( mcrypt_ecb($cipher, $key, $data) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing mcrypt_ecb() : error conditions *** + +-- Testing mcrypt_ecb() function with more than expected no. of arguments -- + +Warning: mcrypt_ecb() expects at most 5 parameters, 6 given in %s on line %d +NULL + +-- Testing mcrypt_ecb() function with less than expected no. of arguments -- + +Warning: mcrypt_ecb() expects at least 4 parameters, 3 given in %s on line %d +NULL +===DONE=== + |