|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace MailSoTests; |
|
4
|
|
|
|
|
5
|
|
|
class ImapClientTest extends \PHPUnit_Framework_TestCase |
|
6
|
|
|
{ |
|
7
|
|
|
const CRLF = "\r\n"; |
|
8
|
|
|
|
|
9
|
|
|
public function testNamespace() |
|
10
|
|
|
{ |
|
11
|
|
|
$rConnect = \MailSo\Base\StreamWrappers\Test::CreateStream( |
|
12
|
|
|
'* NAMESPACE (("" "/")) NIL NIL'.self::CRLF. |
|
13
|
|
|
'TAG1 OK Success'.self::CRLF |
|
14
|
|
|
); |
|
15
|
|
|
|
|
16
|
|
|
$oImapClient = \MailSo\Imap\ImapClient::NewInstance()->TestSetValues($rConnect, array('NAMESPACE')); |
|
17
|
|
|
$oResult = $oImapClient->GetNamespace(); |
|
18
|
|
|
|
|
19
|
|
|
$this->assertTrue($oResult instanceof \MailSo\Imap\NamespaceResult); |
|
|
|
|
|
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function testQuota() |
|
23
|
|
|
{ |
|
24
|
|
|
$rConnect = \MailSo\Base\StreamWrappers\Test::CreateStream( |
|
25
|
|
|
'* QUOTAROOT "INBOX" ""'.self::CRLF. |
|
26
|
|
|
'* QUOTA "" (STORAGE 55163 10511217)'.self::CRLF. |
|
27
|
|
|
'TAG1 OK Success'.self::CRLF |
|
28
|
|
|
); |
|
29
|
|
|
|
|
30
|
|
|
$oImapClient = \MailSo\Imap\ImapClient::NewInstance()->TestSetValues($rConnect, array('QUOTA')); |
|
31
|
|
|
|
|
32
|
|
|
$aResult = $oImapClient->Quota(); |
|
33
|
|
|
$this->assertTrue(is_array($aResult)); |
|
34
|
|
|
$this->assertEquals(4, count($aResult)); |
|
35
|
|
|
$this->assertEquals(55163, $aResult[0]); |
|
36
|
|
|
$this->assertEquals(10511217, $aResult[1]); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function testFolderList() |
|
40
|
|
|
{ |
|
41
|
|
|
$rConnect = \MailSo\Base\StreamWrappers\Test::CreateStream( |
|
42
|
|
|
'* LIST (\Noselect) "/" 0'.self::CRLF. |
|
43
|
|
|
'* LIST (\UnMarked) "/" 0/1'.self::CRLF. |
|
44
|
|
|
'* LIST (\Noselect) "/" 1'.self::CRLF. |
|
45
|
|
|
'* LIST (\Noselect) "/" 1/2'.self::CRLF. |
|
46
|
|
|
'* LIST (\UnMarked) "/" 1/2/3'.self::CRLF. |
|
47
|
|
|
'* LIST (\UnMarked \Inbox) "/" INBOX'.self::CRLF. |
|
48
|
|
|
'* LIST (\UnMarked) "/" "INBOX/XXX XXX"'.self::CRLF. |
|
49
|
|
|
'* LIST (\UnMarked) "/" &-BT,MAQBDoEM'.self::CRLF. |
|
50
|
|
|
'* LIST (\UnMarked) "NIL" NILDelimiteFolder'.self::CRLF. |
|
51
|
|
|
'* LIST (\UnMarked) "" EmptyDelimiteFolder'.self::CRLF. |
|
52
|
|
|
'TAG1 OK Success'.self::CRLF |
|
53
|
|
|
); |
|
54
|
|
|
|
|
55
|
|
|
$oImapClient = \MailSo\Imap\ImapClient::NewInstance()->TestSetValues($rConnect); |
|
56
|
|
|
|
|
57
|
|
|
$aResult = $oImapClient->FolderList(); |
|
58
|
|
|
$this->assertTrue(is_array($aResult) && 0 < count($aResult)); |
|
59
|
|
|
$this->assertTrue($aResult[0] instanceof \MailSo\Imap\Folder); |
|
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
$this->assertEquals('0', $aResult[0]->FullNameRaw()); |
|
62
|
|
|
$this->assertEquals('0', $aResult[0]->NameRaw()); |
|
63
|
|
|
$this->assertEquals('0/1', $aResult[1]->FullNameRaw()); |
|
64
|
|
|
$this->assertEquals('1', $aResult[1]->NameRaw()); |
|
65
|
|
|
$this->assertEquals('1', $aResult[2]->FullNameRaw()); |
|
66
|
|
|
$this->assertEquals('1/2', $aResult[3]->FullNameRaw()); |
|
67
|
|
|
$this->assertEquals('1/2/3', $aResult[4]->FullNameRaw()); |
|
68
|
|
|
$this->assertEquals('3', $aResult[4]->NameRaw()); |
|
69
|
|
|
$this->assertEquals('INBOX', $aResult[5]->FullNameRaw()); |
|
70
|
|
|
$this->assertEquals('INBOX/XXX XXX', $aResult[6]->FullNameRaw()); |
|
71
|
|
|
$this->assertEquals('XXX XXX', $aResult[6]->NameRaw()); |
|
72
|
|
|
$this->assertEquals('&-BT,MAQBDoEM', $aResult[7]->FullNameRaw()); |
|
73
|
|
|
|
|
74
|
|
|
$this->assertTrue($aResult[5] instanceof \MailSo\Imap\Folder); |
|
|
|
|
|
|
75
|
|
|
$this->assertEquals('/', $aResult[5]->Delimiter()); |
|
76
|
|
|
$this->assertEquals(2, count($aResult[5]->FlagsLowerCase())); |
|
77
|
|
|
$this->assertTrue(in_array('\inbox', $aResult[5]->FlagsLowerCase())); |
|
78
|
|
|
|
|
79
|
|
|
$this->assertTrue($aResult[8] instanceof \MailSo\Imap\Folder); |
|
|
|
|
|
|
80
|
|
|
$this->assertEquals('.', $aResult[8]->Delimiter()); |
|
81
|
|
|
|
|
82
|
|
|
$this->assertTrue($aResult[9] instanceof \MailSo\Imap\Folder); |
|
|
|
|
|
|
83
|
|
|
$this->assertEquals('.', $aResult[8]->Delimiter()); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.jsonfile (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.jsonto be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
requireorrequire-devsection?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceofchecks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.