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