Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117752708
Utils.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
Utils.php
View Options
<?php
/**
* Test class to test rcmail_utils class
*
* @package Tests
*/
class
Rcmail_RcmailUtils
extends
ActionTestCase
{
/**
* Test for db() method
*/
function
test_db
()
{
$db
=
rcmail_utils
::
db
();
$this
->
assertInstanceOf
(
'rcube_db'
,
$db
);
}
/**
* Test for db_version() method
*/
function
test_db_version
()
{
// FIXME: It breaks the test suite for some reason
$this
->
markTestIncomplete
();
$v
=
rcmail_utils
::
db_version
();
$this
->
assertMatchesRegularExpression
(
'/^[0-9]{10}$/'
,
$v
);
}
/**
* Test for db_clean() method
*/
function
test_db_clean
()
{
ob_start
();
rcmail_utils
::
db_clean
(
7
);
$output
=
ob_get_contents
();
ob_end_clean
();
$this
->
assertTrue
(
strpos
(
$output
,
'0 records deleted'
)
!==
false
);
}
/**
* Test for indexcontacts() method
*/
function
test_indexcontacts
()
{
self
::
initDB
(
'contacts'
);
ob_start
();
rcmail_utils
::
indexcontacts
();
$output
=
ob_get_contents
();
ob_end_clean
();
$this
->
assertTrue
(
strpos
(
$output
,
'Indexing contacts for user'
)
===
0
);
}
/**
* Test for mod_pref() method
*/
function
test_mod_pref
()
{
// FIXME: The test hangs for some reason, probably related with the extra DB connection
$this
->
markTestIncomplete
();
self
::
initDB
(
'init'
);
$db
=
rcmail
::
get_instance
()->
get_dbh
();
ob_start
();
rcmail_utils
::
mod_pref
(
'test'
,
[]);
$output
=
ob_get_contents
();
ob_end_clean
();
$this
->
assertTrue
(
strpos
(
$output
,
'Updating prefs for user 1'
)
!==
false
);
$this
->
assertTrue
(
strpos
(
$output
,
'saved'
)
!==
false
);
$query
=
$db
->
query
(
'SELECT preferences FROM `users` WHERE `user_id` = 1'
);
$result
=
$db
->
fetch_assoc
(
$query
);
$prefs
=
unserialize
(
$result
[
'preferences'
]);
$this
->
assertSame
([],
$prefs
[
'test'
]);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Apr 4, 4:32 AM (1 d, 2 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c3/1e/95e4a6539c277cf0132617a89ac3
Default Alt Text
Utils.php (1 KB)
Attached To
Mode
R113 roundcubemail
Attached
Detach File
Event Timeline