xref: /PHP-8.2/ext/imap/tests/imap_lsub_basic.phpt (revision b5a14e6c)
1--TEST--
2imap_lsub() function : basic functionality
3--CREDITS--
4Olivier Doucet
5--EXTENSIONS--
6imap
7--SKIPIF--
8<?php
9require_once(__DIR__.'/setup/skipif.inc');
10if (getenv("SKIP_ASAN")) die("skip leak sanitizer crashes");
11?>
12--CONFLICTS--
13defaultmailbox
14--FILE--
15<?php
16
17require_once(__DIR__.'/setup/imap_include.inc');
18$stream_id = imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD) or
19    die("Cannot connect to mailbox " .IMAP_DEFAULT_MAILBOX. ": " . imap_last_error());
20
21var_dump(imap_lsub($stream_id, IMAP_DEFAULT_MAILBOX, 'ezDvfXvbvcxSerz'));
22
23
24echo "Checking OK\n";
25
26$newbox = IMAP_DEFAULT_MAILBOX . "." . IMAP_MAILBOX_PHPT_PREFIX;
27
28imap_createmailbox($stream_id, $newbox);
29imap_subscribe($stream_id, $newbox);
30
31$z = imap_lsub($stream_id, IMAP_DEFAULT_MAILBOX, '*');
32
33var_dump(is_array($z));
34
35// e.g. "{127.0.0.1:143/norsh}INBOX.phpttest"
36var_dump($z[0]);
37
38imap_close($stream_id);
39?>
40--CLEAN--
41<?php
42$mailbox_suffix = '';
43require_once(__DIR__.'/setup/clean.inc');
44?>
45--EXPECTF--
46bool(false)
47Checking OK
48bool(true)
49string(%s) "{%s}%s"
50