Files
roundcubemail/tests/Framework/CacheDB.php
Michael Voříšek e7d7e62146 Modernize more basic CS II (#9254)
* fix "integer_literal_case"

* fix "phpdoc_separation"

* fix "phpdoc_var_without_name"

* fix "operator_linebreak"

* fix "no_alias_language_construct_call"

* fix "list_syntax"

* fix "concat_space"

* fix "array_syntax"

* fix "binary_operator_spaces"

* fix "binary_operator_spaces" relaxed

* fix "phpdoc_types_order"

* fix "phpdoc_trim"

* fix "native_type_declaration_casing"

* fix "method_chaining_indentation"

* fix "phpdoc_no_package"

* fix "elseif"

* fix PHP CS Fixer config itself too

* fix "native_type_declaration_casing"
2023-12-17 13:14:45 +01:00

47 lines
996 B
PHP

<?php
/**
* Test class to test rcube_cache_db class
*/
class Framework_CacheDB extends PHPUnit\Framework\TestCase
{
/**
* Test common cache functionality
*/
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();
}
}