PredisCacheTest.php
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace Doctrine\Tests\Common\Cache;
use Doctrine\Common\Cache\Cache;
use Doctrine\Common\Cache\PredisCache;
use Predis\Client;
use Predis\Connection\ConnectionException;
class PredisCacheTest extends CacheTest
{
private $client;
public function setUp()
{
if (!class_exists('Predis\Client')) {
$this->markTestSkipped('Predis\Client is missing. Make sure to "composer install" to have all dev dependencies.');
}
$this->client = new Client();
try {
$this->client->connect();
} catch (ConnectionException $e) {
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis');
}
}
public function testHitMissesStatsAreProvided()
{
$cache = $this->_getCacheDriver();
$stats = $cache->getStats();
$this->assertNotNull($stats[Cache::STATS_HITS]);
$this->assertNotNull($stats[Cache::STATS_MISSES]);
}
/**
* @return PredisCache
*/
protected function _getCacheDriver()
{
return new PredisCache($this->client);
}
/**
* {@inheritDoc}
*
* @dataProvider provideDataToCache
*/
public function testSetContainsFetchDelete($value)
{
if (array() === $value) {
$this->markTestIncomplete(
'Predis currently doesn\'t support saving empty array values. '
. 'See https://github.com/nrk/predis/issues/241'
);
}
parent::testSetContainsFetchDelete($value);
}
/**
* {@inheritDoc}
*
* @dataProvider provideDataToCache
*/
public function testUpdateExistingEntry($value)
{
if (array() === $value) {
$this->markTestIncomplete(
'Predis currently doesn\'t support saving empty array values. '
. 'See https://github.com/nrk/predis/issues/241'
);
}
parent::testUpdateExistingEntry($value);
}
}