Conditions | 5 |
Paths | 16 |
Total Lines | 26 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | protected function setUp() { |
||
19 | |||
20 | if ( !class_exists( '\Onoi\Cache\CacheFactory' ) ) { |
||
21 | $this->markTestSkipped( 'CacheFactory is not available' ); |
||
22 | } |
||
23 | |||
24 | if ( !class_exists( '\Redis' ) ) { |
||
25 | $this->markTestSkipped( 'Requires redis php-class/extension to be available' ); |
||
26 | } |
||
27 | |||
28 | $redis = new \Redis(); |
||
29 | |||
30 | if ( !$redis->connect( '127.0.0.1' ) ) { |
||
31 | $this->markTestSkipped( 'Cannot connect to redis' ); |
||
32 | } |
||
33 | |||
34 | if ( !class_exists( '\Doctrine\Common\Cache\RedisCache' ) ) { |
||
35 | $this->markTestSkipped( 'RedisCache is not available' ); |
||
36 | } |
||
37 | |||
38 | $redisCache = new RedisCache(); |
||
39 | $redisCache->setRedis( $redis ); |
||
40 | |||
41 | $cacheFactory = new CacheFactory(); |
||
42 | $this->cache = $cacheFactory->newDoctrineCache( $redisCache ); |
||
43 | } |
||
44 | |||
46 |