Debian Codegraph @

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

raw symbols SCIP
1 <?php
2 /*
3 * File: Issue355Test.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 Issue383Test extends LiveMailboxTestCase {
28
29 /**
30 * Test issue #383 - Does not work when a folder name contains umlauts: Entwürfe
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 $folder_path = implode($delimiter, ['INBOX', 'Entwürfe+']);
48
49 $folder = $client->getFolder($folder_path);
50 $this->deleteFolder($folder);
51
52 $folder = $client->createFolder($folder_path, false);
53 self::assertInstanceOf(Folder::class, $folder);
54
55 $folder = $this->getFolder($folder_path);
56 self::assertInstanceOf(Folder::class, $folder);
57
58 $this->assertEquals('Entwürfe+', $folder->name);
59 $this->assertEquals($folder_path, $folder->full_name);
60
61 $folder_path = implode($delimiter, ['INBOX', 'Entw&APw-rfe+']);
62 $this->assertEquals($folder_path, $folder->path);
63
64 // Clean up
65 if ($this->deleteFolder($folder) === false) {
66 $this->fail("Could not delete folder: " . $folder->path);
67 }
68 }
69 }