18 lines
846 B
PHP
18 lines
846 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once PLUGIN_ROOT . '/exec/lib/MailboxDirectory.php';
|
|
|
|
test('mailbox directory returns only pop imap mailboxes owned by user', function (): void {
|
|
$root = TEST_TMP . '/etc_virtual';
|
|
test_write($root . '/domainowners', "example.com: alice\nother.com: bob\n");
|
|
test_write($root . '/example.com/passwd', "info:x:1000:12::/home/alice/imap/example.com/info:/bin/false\nsales:x:1000:12::/home/alice/imap/example.com/sales:/bin/false\n");
|
|
test_write($root . '/example.com/aliases', "alias: info\n");
|
|
test_write($root . '/other.com/passwd', "info:x:1001:12::/home/bob/imap/other.com/info:/bin/false\n");
|
|
|
|
$dir = new MailboxDirectory($root);
|
|
$mailboxes = $dir->mailboxesForUser('alice');
|
|
|
|
assert_same(['info@example.com', 'sales@example.com'], array_column($mailboxes, 'email'));
|
|
});
|