/
AccountData.php.dist
199 lines (184 loc) · 7 KB
/
AccountData.php.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?php
declare(strict_types=1);
namespace MStilkerich\Tests\CardDavClient;
use MStilkerich\CardDavClient\{Account,AddressbookCollection,Config};
final class AccountData
{
public const ACCOUNTS = [
/*
"iCloud" => [
"username" => "icloudid@example.com",
"password" => "foobar",
"discoveryUri" => "icloud.com",
// For providers that report extra changes or deleted cards between two syncs, set this to true to limit the
// sync tests to check whether all known changes are actually reported, without raising an error on any
// additional changes that the server reports. (Google has been observed to behave like this)
"syncAllowExtraChanges" => false,
],
"Google" => [
"username" => "gmailid@example.com",
"password" => "foobar",
"discoveryUri" => "gmail.com",
"syncAllowExtraChanges" => true,
],
*/
"Nextcloud" => [
"username" => "ncadm",
"password" => "ncadmPassw0rd",
"discoveryUri" => "http://localhost:8080/remote.php/dav/",
"syncAllowExtraChanges" => false,
],
/*
"Baikal" => [
"username" => "baikalUser",
"password" => "foobar",
"discoveryUri" => "http://baikal.localhost",
"syncAllowExtraChanges" => false,
],
"BaikalKrb" => [
"username" => "",
"password" => "",
"discoveryUri" => "http://baikal.example.com",
"syncAllowExtraChanges" => false,
],
"Owncloud" => [
"username" => "owncloudUser",
"password" => "foobar",
"discoveryUri" => "http://localhost/owncloud/remote.php/dav/addressbooks/users/owncloudUser/contacts/",
"syncAllowExtraChanges" => false,
],
"Radicale" => [
"username" => "radicaleUser",
"password" => "foobar",
"discoveryUri" => "http://localhost:5232/",
"syncAllowExtraChanges" => false,
],
"Davical" => [
"username" => "davicalUser",
"password" => "foobar",
"discoveryUri" => "http://localhost/davical",
"syncAllowExtraChanges" => false,
],
*/
];
public const ADDRESSBOOKS = [
/*
"iCloud" => [
"account" => "iCloud",
"url" => "https://pXX-contacts.icloud.com:443/1234567/carddavhome/card/",
"displayname" => "card",
"supports_synccoll" => true,
"supports_multiget" => true,
"supports_ctag" => false,
],
"Google" => [
"account" => "Google",
"url" => "https://www.googleapis.com:443/carddav/v1/principals/gmailid@example.com/lists/default/",
"displayname" => "Address Book",
"supports_synccoll" => true,
"supports_multiget" => true,
"supports_ctag" => true,
],
*/
"Nextcloud" => [
"account" => "Nextcloud",
"url" => "http://localhost:8080/remote.php/dav/addressbooks/users/ncadm/contacts/",
"displayname" => "Contacts",
"supports_synccoll" => true,
"supports_multiget" => true,
"supports_ctag" => true,
],
/*
"Owncloud" => [
"account" => "Owncloud",
"url" => "http://localhost:80/owncloud/remote.php/dav/addressbooks/users/owncloudUser/contacts/",
"displayname" => "Contacts",
"supports_synccoll" => true,
"supports_multiget" => true,
"supports_ctag" => true,
],
"Baikal_First" => [
"account" => "Baikal",
"url" => "http://baikal.localhost/dav.php/addressbooks/baikalUser/default/",
"displayname" => "Default Address Book",
"supports_synccoll" => true,
"supports_multiget" => true,
"supports_ctag" => true,
],
"Baikal_Second" => [
"account" => "Baikal",
"url" => "http://baikal.localhost/dav.php/addressbooks/baikalUser/abook2/",
"displayname" => "Addressbook 2",
"supports_synccoll" => true,
"supports_multiget" => true,
"supports_ctag" => true,
],
"BaikalKrb_First" => [
"account" => "BaikalKrb",
"url" => "http://baikal.example.com/dav.php/addressbooks/baikalUser/default/",
"displayname" => "Default Address Book",
"supports_synccoll" => true,
"supports_multiget" => true,
"supports_ctag" => true,
],
"Radicale" => [
"account" => "Radicale",
"url" => "http://localhost:5232/radicaleUser/abcdef/",
"displayname" => "The radical addressbook",
"supports_synccoll" => true,
"supports_multiget" => true,
"supports_ctag" => true,
],
"Davical_0" => [
"account" => "Davical",
"url" => "http://localhost/davical/caldav.php/davicalUser/addresses/",
"displayname" => "Test addressbook",
"supports_synccoll" => true,
"supports_multiget" => true,
"supports_ctag" => true,
],
*/
];
/** @var Account[] Caches the Account objects for all accounts from ACCOUNTS*/
public static $accounts = [];
/** @var AddressbookCollection[] Caches the AddressbookCollection objects for all addressbooks from ADDRESSBOOKS */
public static $addressbooks = [];
public static function init(): void
{
if (empty(self::$accounts)) {
if (file_exists('testreports/tests.log')) {
unlink('testreports/tests.log');
}
if (file_exists('testreports/tests_http.log')) {
unlink('testreports/tests_http.log');
}
Config::init(
$logger = new \Wa72\SimpleLogger\FileLogger('testreports/tests.log', \Psr\Log\LogLevel::DEBUG),
$logger = new \Wa72\SimpleLogger\FileLogger('testreports/tests_http.log', \Psr\Log\LogLevel::DEBUG)
);
}
foreach (self::ACCOUNTS as $name => $cfg) {
self::$accounts[$name] = new Account($cfg["discoveryUri"], $cfg["username"], $cfg["password"]);
}
foreach (self::ADDRESSBOOKS as $name => $cfg) {
self::$addressbooks[$name] = new AddressbookCollection($cfg["url"], self::$accounts[$cfg["account"]]);
}
}
public static function accountProvider(): array
{
$ret = [];
foreach (self::ACCOUNTS as $name => $cfg) {
$ret[$name] = [ $name, $cfg ];
}
return $ret;
}
public static function addressbookProvider(): array
{
$ret = [];
foreach (self::ADDRESSBOOKS as $name => $cfg) {
$ret[$name] = [ $name, $cfg ];
}
return $ret;
}
}
// vim: ts=4:sw=4:expandtab:fenc=utf8:ff=unix:tw=120:ft=php