mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-07 00:26:48 +01:00
* Fix "method_argument_space" * Fix "control_structure_continuation_position" * Fix "new_with_parentheses" * Fix "blank_line_before_statement" * Fix "visibility_required" * Fix some "array_indentation" * Fix some "array_indentation" - unify all "rcube::raise_error" calls * rm useless eslint ignores and add rules counts * sort eslint ignores * fix eslint ignores grammar * Revert "Fix "blank_line_before_statement"" * fix CS 3.46.0
47 lines
1003 B
PHP
47 lines
1003 B
PHP
<?php
|
|
|
|
/**
|
|
* Test class to test rcube_cache_db class
|
|
*/
|
|
class Framework_CacheDB extends PHPUnit\Framework\TestCase
|
|
{
|
|
/**
|
|
* Test common cache functionality
|
|
*/
|
|
public function test_common_cache_operations()
|
|
{
|
|
$rcube = rcube::get_instance();
|
|
$db = $rcube->get_dbh();
|
|
$db->query('DELETE FROM cache');
|
|
|
|
$cache = new rcube_cache_db(1, 'test', 60);
|
|
|
|
// Set and get cache record
|
|
$data = ['data'];
|
|
|
|
$cache->set('test', $data);
|
|
|
|
$this->assertSame($data, $cache->get('test'));
|
|
|
|
$cache->close();
|
|
|
|
$cache = new rcube_cache_db(1, 'test', 60);
|
|
|
|
$this->assertSame($data, $cache->get('test'));
|
|
|
|
// Remove cached record
|
|
$cache->remove('test');
|
|
|
|
$this->assertNull($cache->get('test'));
|
|
|
|
$cache->close();
|
|
|
|
$cache = new rcube_cache_db(1, 'test', 60);
|
|
|
|
$this->assertNull($cache->get('test'));
|
|
|
|
// Call expunge methods
|
|
$cache->expunge();
|
|
}
|
|
}
|