Debian Codegraph @

lib/3rdParty/composer/webklex/php-imap/tests/ImapProtocolTest.php

raw symbols SCIP
1 <?php
2 /*
3 * File: ImapProtocolTest.php
4 * Category: -
5 * Author: M.Goldenbaum
6 * Created: 28.12.22 18:11
7 * Updated: -
8 *
9 * Description:
10 * -
11 */
12
13 namespace Tests;
14
15 use PHPUnit\Framework\TestCase;
16 use Webklex\PHPIMAP\Config;
17 use Webklex\PHPIMAP\Connection\Protocols\ImapProtocol;
18 use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
19
20 class ImapProtocolTest extends TestCase {
21
22 /** @var Config $config */
23 protected Config $config;
24
25 /**
26 * Setup the test environment.
27 *
28 * @return void
29 */
30 public function setUp(): void {
31 $this->config = Config::make();
32 }
33
34
35 /**
36 * ImapProtocol test
37 *
38 * @return void
39 */
40 public function testImapProtocol(): void {
41
42 $protocol = new ImapProtocol($this->config, false);
43 self::assertSame(false, $protocol->getCertValidation());
44 self::assertSame("", $protocol->getEncryption());
45
46 $protocol->setCertValidation(true);
47 $protocol->setEncryption("ssl");
48
49 self::assertSame(true, $protocol->getCertValidation());
50 self::assertSame("ssl", $protocol->getEncryption());
51
52 $protocol->setSslOptions([
53 'verify_peer' => true,
54 'cafile' => '/dummy/path/for/testing',
55 'peer_fingerprint' => ['md5' => 40],
56 ]);
57
58 self::assertSame([
59 'verify_peer' => true,
60 'cafile' => '/dummy/path/for/testing',
61 'peer_fingerprint' => ['md5' => 40],
62 ], $protocol->getSslOptions());
63 }
64 }