Annotation of embedaddon/php/ext/imap/tests/imap_base64_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test imap_base64() function : basic functionality 
                      3: --SKIPIF--
                      4: <?php
                      5: extension_loaded('imap') or die('skip imap extension not available in this build');
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: /* Prototype  : string imap_base64  ( string $text  )
                     10:  * Description: Decode BASE64 encoded text.
                     11:  * Source code: ext/imap/php_imap.c
                     12:  */
                     13: 
                     14: echo "*** Testing imap_base64() : basic functionality ***\n";
                     15: 
                     16: $str = b'This is an example string to be base 64 encoded';
                     17: $base64 = base64_encode($str);
                     18: if (imap_base64($base64) == $str) {
                     19:        echo "TEST PASSED\n";
                     20: } else {
                     21:        echo "TEST FAILED";
                     22: }
                     23: 
                     24: $str = b'!£$%^&*()_+-={][];;@~#?/>.<,';
                     25: $base64 = base64_encode($str);
                     26: if (imap_base64($base64) == $str) {
                     27:        echo "TEST PASSED\n";
                     28: } else {
                     29:        echo "TEST FAILED";
                     30: }
                     31: 
                     32: $hex = b'x00\x01\x02\x03\x04\x05\x06\xFA\xFB\xFC\xFD\xFE\xFF';
                     33: $base64 = base64_encode($hex);
                     34: if (imap_base64($base64) == $hex) {
                     35:        echo "TEST PASSED\n";
                     36: } else {
                     37:        echo "TEST FAILED";
                     38: }              
                     39: 
                     40: ?>
                     41: ===Done===
                     42: --EXPECT--
                     43: *** Testing imap_base64() : basic functionality ***
                     44: TEST PASSED
                     45: TEST PASSED
                     46: TEST PASSED
                     47: ===Done===

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