Skip to content

Commit fd5be78

Browse files
committed
SizeTest now working
1 parent 782e646 commit fd5be78

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

tests/SizeTest.php

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
/*
3+
* File: SizeTest.php
4+
* Category: -
5+
* Author: D.Malli
6+
* Created: 24.02.23 15:53
7+
* Updated: -
8+
*
9+
* Description: Tests FETCH NNN RFC822.SIZE (issue 378)
10+
* -
11+
*/
12+
13+
// Note: This is no real unit test, as it needs a real server to make sense.
14+
// I installed composer to the tests directory and had to:
15+
// composer require illuminate/pagination
16+
// to make the pagination library available!
17+
// Fill in your real configuration to use this file:
18+
$CONFIG = array(
19+
'host' => 'toFill',
20+
'port' => 993,
21+
'encryption' => 'ssl',
22+
'validate_cert' => true,
23+
'username' => 'toFill',
24+
'password' => 'toFill',
25+
'protocol' => 'imap'
26+
);
27+
set_include_path('/home/didi1357/git/php-imap/src');
28+
29+
30+
ini_set('display_errors', 1);
31+
ini_set('display_startup_errors', 1);
32+
error_reporting(E_ALL);
33+
34+
require_once 'IMAP.php';
35+
require_once 'Traits/HasEvents.php';
36+
require_once 'Exceptions/MaskNotFoundException.php';
37+
require_once 'Client.php';
38+
require_once 'ClientManager.php';
39+
require_once 'Support/Masks/Mask.php';
40+
require_once 'Support/Masks/MessageMask.php';
41+
require_once 'Support/Masks/AttachmentMask.php';
42+
require_once 'Connection/Protocols/Response.php';
43+
require_once 'Connection/Protocols/ProtocolInterface.php';
44+
require_once 'Connection/Protocols/Protocol.php';
45+
require_once 'Connection/Protocols/ImapProtocol.php';
46+
require_once '../tests/vendor/autoload.php';
47+
require_once 'Support/PaginatedCollection.php';
48+
require_once 'Support/FolderCollection.php';
49+
require_once 'Folder.php';
50+
require_once 'Exceptions/ResponseException.php';
51+
require_once 'Query/Query.php';
52+
require_once 'Query/WhereQuery.php';
53+
require_once 'Support/MessageCollection.php';
54+
require_once 'Support/FlagCollection.php';
55+
require_once 'Support/AttachmentCollection.php';
56+
require_once 'Part.php';
57+
require_once 'Structure.php';
58+
require_once 'Attribute.php';
59+
require_once 'Address.php';
60+
require_once 'EncodingAliases.php';
61+
require_once 'Header.php';
62+
require_once 'Message.php';
63+
64+
use Webklex\PHPIMAP\ClientManager;
65+
use Webklex\PHPIMAP\Support\Masks\MessageMask;
66+
use Webklex\PHPIMAP\Support\Masks\AttachmentMask;
67+
68+
$CONFIG['masks'] = array(
69+
'message' => MessageMask::class,
70+
'attachment' => AttachmentMask::class
71+
);
72+
echo "<pre>";
73+
$cm = new ClientManager($options = []);
74+
$client = $cm->make($CONFIG)->connect();
75+
//$client->getConnection()->enableDebug(); // uncomment this for debug output!
76+
$folder = $client->getFolderByPath('INBOX');
77+
//$message = $folder->messages()->getMessageByMsgn(1); // did not work as msgn implementation is currently broken!
78+
$message = $folder->messages()->getMessageByUid(2);
79+
var_dump($message->getSize());
80+
81+
82+
?>
83+

0 commit comments

Comments
 (0)