Files
roundcubemail/tests/Framework/CacheDB.php
Michael Voříšek 6a53a1d853 Fix CS (whitespace, visibility) (#9297)
* 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
2024-01-04 14:26:35 +01:00

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();
}
}