| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 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 |
|
| 23 |
protected Config $config; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
public function setUp(): void { |
| 31 |
$this->config = Config::make(); |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 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 |
} |