forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCacheArrayStoreTest.php
More file actions
executable file
·60 lines (46 loc) · 1.32 KB
/
CacheArrayStoreTest.php
File metadata and controls
executable file
·60 lines (46 loc) · 1.32 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
<?php
use Illuminate\Cache\ArrayStore;
class CacheArrayStoreTest extends PHPUnit_Framework_TestCase {
public function testItemsCanBeSetAndRetrieved()
{
$store = new ArrayStore;
$store->put('foo', 'bar', 10);
$this->assertEquals('bar', $store->get('foo'));
}
public function testStoreItemForeverProperlyStoresInArray()
{
$mock = $this->getMock('Illuminate\Cache\ArrayStore', array('put'));
$mock->expects($this->once())->method('put')->with($this->equalTo('foo'), $this->equalTo('bar'), $this->equalTo(0));
$mock->forever('foo', 'bar');
}
public function testValuesCanBeIncremented()
{
$store = new ArrayStore;
$store->put('foo', 1, 10);
$store->increment('foo');
$this->assertEquals(2, $store->get('foo'));
}
public function testValuesCanBeDecremented()
{
$store = new ArrayStore;
$store->put('foo', 1, 10);
$store->decrement('foo');
$this->assertEquals(0, $store->get('foo'));
}
public function testItemsCanBeRemoved()
{
$store = new ArrayStore;
$store->put('foo', 'bar', 10);
$store->forget('foo');
$this->assertNull($store->get('foo'));
}
public function testItemsCanBeFlushed()
{
$store = new ArrayStore;
$store->put('foo', 'bar', 10);
$store->put('baz', 'boom', 10);
$store->flush();
$this->assertNull($store->get('foo'));
$this->assertNull($store->get('baz'));
}
}