Files
roundcubemail/tests/Framework/CacheDB.php
Michael Voříšek d18406a8bd Fix binary operator spaces CS (#9330)
* align_single_space_minimal for assign

* assign operators grouping is not supported by PHP CS Fixer

* binary_operator_spaces = single_space

* fix anonymous function on single line

* align comments manually
2024-02-02 07:53:34 +01:00

49 lines
1014 B
PHP

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