Annotation of embedaddon/php/ext/mcrypt/tests/mcrypt_encrypt_error.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test mcrypt_encrypt() function : error conditions 
        !             3: --SKIPIF--
        !             4: <?php 
        !             5: if (!extension_loaded("mcrypt")) {
        !             6:        print "skip - mcrypt extension not loaded"; 
        !             7: }       
        !             8: ?>
        !             9: --FILE--
        !            10: <?php
        !            11: /* Prototype  : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
        !            12:  * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv 
        !            13:  * Source code: ext/mcrypt/mcrypt.c
        !            14:  * Alias to functions: 
        !            15:  */
        !            16: 
        !            17: echo "*** Testing mcrypt_encrypt() : error conditions ***\n";
        !            18: 
        !            19: 
        !            20: //Test mcrypt_encrypt with one more than the expected number of arguments
        !            21: echo "\n-- Testing mcrypt_encrypt() function with more than expected no. of arguments --\n";
        !            22: $cipher = 'string_val';
        !            23: $key = 'string_val';
        !            24: $data = 'string_val';
        !            25: $mode = 'string_val';
        !            26: $iv = 'string_val';
        !            27: $extra_arg = 10;
        !            28: var_dump( mcrypt_encrypt($cipher, $key, $data, $mode, $iv, $extra_arg) );
        !            29: 
        !            30: // Testing mcrypt_encrypt with one less than the expected number of arguments
        !            31: echo "\n-- Testing mcrypt_encrypt() function with less than expected no. of arguments --\n";
        !            32: $cipher = 'string_val';
        !            33: $key = 'string_val';
        !            34: $data = 'string_val';
        !            35: var_dump( mcrypt_encrypt($cipher, $key, $data) );
        !            36: 
        !            37: ?>
        !            38: ===DONE===
        !            39: --EXPECTF--
        !            40: *** Testing mcrypt_encrypt() : error conditions ***
        !            41: 
        !            42: -- Testing mcrypt_encrypt() function with more than expected no. of arguments --
        !            43: 
        !            44: Warning: mcrypt_encrypt() expects at most 5 parameters, 6 given in %s on line %d
        !            45: NULL
        !            46: 
        !            47: -- Testing mcrypt_encrypt() function with less than expected no. of arguments --
        !            48: 
        !            49: Warning: mcrypt_encrypt() expects at least 4 parameters, 3 given in %s on line %d
        !            50: NULL
        !            51: ===DONE===
        !            52: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>