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