Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for AdminSettings::initPresets() (work in progress)
- Loading branch information
1 parent
da9b481
commit b1c0790
Showing
5 changed files
with
339 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
$prefs['_GLOBAL']['loglevel'] = \Psr\Log\LogLevel::DEBUG; | ||
$prefs['_GLOBAL']['loglevel_http'] = \Psr\Log\LogLevel::INFO; | ||
|
||
$prefs['UpdatedPreset'] = [ | ||
'accountname' => 'Updated Account', | ||
'discovery_url' => 'https://carddav.example.com/', | ||
|
||
'fixed' => [ 'username', 'refresh_time', 'require_always_email', 'name' ], | ||
|
||
'username' => 'foodoo', | ||
'password' => 'bar', | ||
'rediscover_time' => '1:00', | ||
|
||
'refresh_time' => '0:30', | ||
'require_always_email' => true, | ||
'name' => '%N (%D)', | ||
'use_categories' => false, | ||
|
||
'extra_addressbooks' => [ | ||
[ | ||
'url' => 'https://carddav.example.com/global/UpdatedXBook/', | ||
'name' => 'Public readonly contacts', | ||
'readonly' => true, | ||
'require_always_email' => false, | ||
], | ||
[ | ||
'url' => 'https://carddav.example.com/global/NewXBook/', | ||
'name' => '%D', | ||
'readonly' => true, | ||
'require_always_email' => false, | ||
'active' => false | ||
], | ||
[ | ||
'url' => 'https://carddav.example.com/global/InvalidXBook/', | ||
], | ||
], | ||
]; | ||
|
||
// vim: ts=4:sw=4:expandtab:fenc=utf8:ff=unix:tw=120:ft=php |
111 changes: 111 additions & 0 deletions
111
tests/Unit/data/adminSettingsWithDataTest/initPresetsDb.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{ | ||
"accounts": [ | ||
{ | ||
"id": 42, | ||
"accountname": "Removed Account", | ||
"username": "%u", | ||
"password": "%p", | ||
"discovery_url": "https://rm.example.com/", | ||
"user_id": "105", | ||
"last_discovered": 12345, | ||
"rediscover_time": 86400, | ||
"presetname": "RemovedPreset" | ||
}, | ||
{ | ||
"id": 43, | ||
"accountname": "Updated Account", | ||
"username": "foo", | ||
"password": "bar", | ||
"discovery_url": "https://carddav.example.com/", | ||
"user_id": "105", | ||
"last_discovered": 12345, | ||
"rediscover_time": 86400, | ||
"presetname": "UpdatedPreset" | ||
} | ||
], | ||
"addressbooks": [ | ||
{ | ||
"id": 42, | ||
"name": "Discovered", | ||
"url": "https://rm.example.com/books/johndoe/book42/", | ||
"flags": 7, | ||
"last_updated": 12345, | ||
"refresh_time": 3600, | ||
"sync_token": "sync@3600", | ||
"account_id": 42 | ||
}, | ||
{ | ||
"id": 43, | ||
"name": "Extra addressbook", | ||
"url": "https://rm.example.com/books/johndoe/book43/", | ||
"flags": 11, | ||
"last_updated": 12345, | ||
"refresh_time": 3600, | ||
"sync_token": "sync@3600", | ||
"account_id": 42 | ||
}, | ||
{ | ||
"id": 44, | ||
"name": "%N", | ||
"url": "", | ||
"flags": 35, | ||
"last_updated": 0, | ||
"refresh_time": 3600, | ||
"sync_token": "", | ||
"account_id": 42 | ||
}, | ||
|
||
|
||
|
||
{ | ||
"id": 51, | ||
"name": "Discovered addressbook", | ||
"url": "https://carddav.example.com/books/johndoe/book42/", | ||
"flags": 7, | ||
"last_updated": 12345, | ||
"refresh_time": 3600, | ||
"sync_token": "sync@3600", | ||
"account_id": 43 | ||
}, | ||
{ | ||
"id": 52, | ||
"name": "Removed extra addressbook", | ||
"url": "https://carddav.example.com/global/RemovedBook/", | ||
"flags": 3, | ||
"last_updated": 12345, | ||
"refresh_time": 3600, | ||
"sync_token": "sync@3600", | ||
"account_id": 43 | ||
}, | ||
{ | ||
"id": 53, | ||
"name": "%N", | ||
"url": "", | ||
"flags": 35, | ||
"last_updated": 0, | ||
"refresh_time": 3600, | ||
"sync_token": "", | ||
"account_id": 43 | ||
}, | ||
{ | ||
"id": 54, | ||
"name": "Updated extra addressbook", | ||
"url": "https://carddav.example.com/global/UpdatedXBook/", | ||
"flags": 3, | ||
"last_updated": 12345, | ||
"refresh_time": 3600, | ||
"sync_token": "sync@3600", | ||
"account_id": 43 | ||
}, | ||
{ | ||
"id": 55, | ||
"name": "Discovered addressbook not existent on server anymore", | ||
"url": "https://carddav.example.com/books/johndoe/book55/", | ||
"flags": 7, | ||
"last_updated": 12345, | ||
"refresh_time": 3600, | ||
"sync_token": "sync@3600", | ||
"account_id": 43 | ||
} | ||
] | ||
} |
67 changes: 67 additions & 0 deletions
67
tests/Unit/data/adminSettingsWithDataTest/initPresetsDbAfter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"accounts": [ | ||
{ | ||
"id": 43, | ||
"accountname": "Updated Account", | ||
"username": "foodoo", | ||
"password": "bar", | ||
"discovery_url": "https://carddav.example.com/", | ||
"user_id": "105", | ||
"last_discovered": 12345, | ||
"rediscover_time": 86400, | ||
"presetname": "UpdatedPreset" | ||
} | ||
], | ||
"addressbooks": [ | ||
{ | ||
"id": 51, | ||
"name": "Book 42 (Hitchhiker's Guide)", | ||
"url": "https://carddav.example.com/books/johndoe/book42/", | ||
"flags": 23, | ||
"last_updated": 12345, | ||
"refresh_time": 1800, | ||
"sync_token": "sync@3600", | ||
"account_id": 43 | ||
}, | ||
{ | ||
"id": 53, | ||
"name": "%N (%D)", | ||
"url": "", | ||
"flags": 51, | ||
"last_updated": 0, | ||
"refresh_time": 1800, | ||
"sync_token": "", | ||
"account_id": 43 | ||
}, | ||
{ | ||
"id": 54, | ||
"name": "Public readonly contacts", | ||
"url": "https://carddav.example.com/global/UpdatedXBook/", | ||
"flags": 11, | ||
"last_updated": 12345, | ||
"refresh_time": 1800, | ||
"sync_token": "sync@3600", | ||
"account_id": 43 | ||
}, | ||
{ | ||
"id": 55, | ||
"name": "Discovered addressbook not existent on server anymore", | ||
"url": "https://carddav.example.com/books/johndoe/book55/", | ||
"flags": 23, | ||
"last_updated": 12345, | ||
"refresh_time": 1800, | ||
"sync_token": "sync@3600", | ||
"account_id": 43 | ||
}, | ||
{ | ||
"id": 56, | ||
"name": "Newly added extra addressbook", | ||
"url": "https://carddav.example.com/global/NewXBook/", | ||
"flags": 8, | ||
"last_updated": 0, | ||
"refresh_time": 1800, | ||
"sync_token": "", | ||
"account_id": 43 | ||
} | ||
] | ||
} |