forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCacheApcStoreTest.php
More file actions
executable file
·67 lines (52 loc) · 2.23 KB
/
CacheApcStoreTest.php
File metadata and controls
executable file
·67 lines (52 loc) · 2.23 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
<?php
class CacheApcStoreTest extends PHPUnit_Framework_TestCase {
public function testGetReturnsNullWhenNotFound()
{
$apc = $this->getMock('Illuminate\Cache\ApcWrapper', array('get'));
$apc->expects($this->once())->method('get')->with($this->equalTo('foobar'))->will($this->returnValue(null));
$store = new Illuminate\Cache\ApcStore($apc, 'foo');
$this->assertNull($store->get('bar'));
}
public function testAPCValueIsReturned()
{
$apc = $this->getMock('Illuminate\Cache\ApcWrapper', array('get'));
$apc->expects($this->once())->method('get')->will($this->returnValue('bar'));
$store = new Illuminate\Cache\ApcStore($apc);
$this->assertEquals('bar', $store->get('foo'));
}
public function testSetMethodProperlyCallsAPC()
{
$apc = $this->getMock('Illuminate\Cache\ApcWrapper', array('put'));
$apc->expects($this->once())->method('put')->with($this->equalTo('foo'), $this->equalTo('bar'), $this->equalTo(60));
$store = new Illuminate\Cache\ApcStore($apc);
$store->put('foo', 'bar', 1);
}
public function testIncrementMethodProperlyCallsAPC()
{
$apc = $this->getMock('Illuminate\Cache\ApcWrapper', array('increment'));
$apc->expects($this->once())->method('increment')->with($this->equalTo('foo'), $this->equalTo(5));
$store = new Illuminate\Cache\ApcStore($apc);
$store->increment('foo', 5);
}
public function testDecrementMethodProperlyCallsAPC()
{
$apc = $this->getMock('Illuminate\Cache\ApcWrapper', array('decrement'));
$apc->expects($this->once())->method('decrement')->with($this->equalTo('foo'), $this->equalTo(5));
$store = new Illuminate\Cache\ApcStore($apc);
$store->decrement('foo', 5);
}
public function testStoreItemForeverProperlyCallsAPC()
{
$apc = $this->getMock('Illuminate\Cache\ApcWrapper', array('put'));
$apc->expects($this->once())->method('put')->with($this->equalTo('foo'), $this->equalTo('bar'), $this->equalTo(0));
$store = new Illuminate\Cache\ApcStore($apc);
$store->forever('foo', 'bar');
}
public function testForgetMethodProperlyCallsAPC()
{
$apc = $this->getMock('Illuminate\Cache\ApcWrapper', array('delete'));
$apc->expects($this->once())->method('delete')->with($this->equalTo('foo'));
$store = new Illuminate\Cache\ApcStore($apc);
$store->forget('foo');
}
}