blob: b84c652d7f5d0b3c6f31c5d24d10749e66984f12 [file] [log] [blame]
Anton Lindqvist1e8be292012-01-21 12:25:08 +01001<?php
2class Test_redis extends CI_Controller
3{
4
5 function __construct()
6 {
7 parent::__construct();
8
9 $this->load->library('unit_test');
10
11 $this->load->driver('cache', array('adapter' => 'redis'));
12 }
13
14 function index()
15 {
16 $this->unit->run($this->cache->redis->is_supported(), 'is_true');
17
18 $this->unit->run($this->cache->redis->save('foo', 'bar'), 'is_true');
19
20 $this->unit->run($this->cache->redis->get('foo'), 'bar');
21
22 $this->unit->run($this->cache->redis->delete('foo'), 'is_true');
23
24 $this->unit->run($this->cache->redis->save('foo', 'bar', 1800), 'is_true');
25
26 $this->unit->run(
27 $this->cache->redis->get_metadata('foo'),
28 array(
29 'data' => 'bar',
30 'expire' => time() + 1800
31 )
32 );
33
34 $this->unit->run($this->cache->redis->clean(), 'is_true');
35
36 $this->unit->run($this->cache->redis->get('foo'), 'is_false');
37
38 $this->unit->run($this->cache->redis->cache_info(), 'is_array');
39
40 echo $this->unit->report();
41 }
42
43}