Debian Codegraph @

lib/3rdParty/composer/webklex/php-imap/tests/issues/Issue393Test.php

raw symbols SCIP
1 <?php
2 /*
3 * File: Issue393Test.php
4 * Category: -
5 * Author: M.Goldenbaum
6 * Created: 10.01.23 10:48
7 * Updated: -
8 *
9 * Description:
10 * -
11 */
12
13 namespace Tests\issues;
14
15 use Tests\live\LiveMailboxTestCase;
16 use Webklex\PHPIMAP\Exceptions\AuthFailedException;
17 use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
18 use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
19 use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
20 use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
21 use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
22 use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
23 use Webklex\PHPIMAP\Exceptions\ResponseException;
24 use Webklex\PHPIMAP\Exceptions\RuntimeException;
25 use Webklex\PHPIMAP\Folder;
26
27 class Issue393Test extends LiveMailboxTestCase {
28
29 /**
30 * Test issue #393 - "Empty response" when calling getFolders()
31 * @return void
32 * @throws AuthFailedException
33 * @throws ConnectionFailedException
34 * @throws EventNotFoundException
35 * @throws FolderFetchingException
36 * @throws ImapBadRequestException
37 * @throws ImapServerErrorException
38 * @throws ResponseException
39 * @throws RuntimeException
40 * @throws MaskNotFoundException
41 */
42 public function testIssue(): void {
43 $client = $this->getClient();
44 $client->connect();
45
46 $delimiter = $this->getManager()->getConfig()->get("options.delimiter");
47 $pattern = implode($delimiter, ['doesnt_exist', '%']);
48
49 $folder = $client->getFolder('doesnt_exist');
50 $this->deleteFolder($folder);
51
52 $folders = $client->getFolders(true, $pattern, true);
53 self::assertCount(0, $folders);
54
55 try {
56 $client->getFolders(true, $pattern, false);
57 $this->fail('Expected FolderFetchingException::class exception not thrown');
58 } catch (FolderFetchingException $e) {
59 self::assertInstanceOf(FolderFetchingException::class, $e);
60 }
61 }
62 }