Skip to content

Commit 2ddec18

Browse files
authored
Merge branch 'master' into add-simple-cache-prefix-decorator
2 parents e0ef809 + 2f584c6 commit 2ddec18

File tree

4 files changed

+41
-28
lines changed

4 files changed

+41
-28
lines changed

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.gitattributes export-ignore
2+
.github/ export-ignore
3+
.gitignore export-ignore
4+
.travis.yml export-ignore
5+
/phpunit.xml.dist export-ignore
6+
/Tests/ export-ignore

Changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
44

55
## UNRELEASED
66

7+
## 1.0.0
8+
9+
### Removed
10+
11+
- Dependency on `cache/hierarchical-cache`
12+
713
## 0.1.2
814

915
### Changed

Tests/PrefixedCachePoolTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@
1616
use Psr\Cache\CacheItemPoolInterface;
1717

1818
/**
19-
* We should not use constants on interfaces in the tests. Tests should break if the constant is changed.
20-
*
2119
* @author Tobias Nyholm <[email protected]>
2220
*/
2321
class PrefixedCachePoolTest extends \PHPUnit_Framework_TestCase
2422
{
2523
/**
26-
* @return \PHPUnit_Framework_MockObject_MockObject
24+
* @return \PHPUnit_Framework_MockObject_MockObject|CacheItemPoolInterface
2725
*/
28-
private function getHierarchyCacheStub()
26+
private function getCacheStub()
2927
{
3028
return $this->getMockBuilder(CacheItemPoolInterface::class)->setMethods(
3129
['getItem', 'getItems', 'hasItem', 'clear', 'deleteItem', 'deleteItems', 'save', 'saveDeferred', 'commit']
@@ -38,7 +36,7 @@ public function testGetItem()
3836
$key = 'key';
3937
$returnValue = true;
4038

41-
$stub = $this->getHierarchyCacheStub();
39+
$stub = $this->getCacheStub();
4240
$stub->expects($this->once())->method('getItem')->with($prefix.$key)->willReturn($returnValue);
4341

4442
$pool = new PrefixedCachePool($stub, $prefix);
@@ -52,7 +50,7 @@ public function testGetItems()
5250
$key1 = 'key1';
5351
$returnValue = true;
5452

55-
$stub = $this->getHierarchyCacheStub();
53+
$stub = $this->getCacheStub();
5654
$stub->expects($this->once())->method('getItems')->with([$prefix.$key0, $prefix.$key1])->willReturn($returnValue);
5755

5856
$pool = new PrefixedCachePool($stub, $prefix);
@@ -65,7 +63,7 @@ public function testHasItem()
6563
$key = 'key';
6664
$returnValue = true;
6765

68-
$stub = $this->getHierarchyCacheStub();
66+
$stub = $this->getCacheStub();
6967
$stub->expects($this->once())->method('hasItem')->with($prefix.$key)->willReturn($returnValue);
7068

7169
$pool = new PrefixedCachePool($stub, $prefix);
@@ -78,11 +76,11 @@ public function testClear()
7876
$key = 'key';
7977
$returnValue = true;
8078

81-
$stub = $this->getHierarchyCacheStub();
79+
$stub = $this->getCacheStub();
8280
$stub->expects($this->once())->method('clear')->willReturn($returnValue);
8381

8482
$pool = new PrefixedCachePool($stub, $prefix);
85-
$this->assertEquals($returnValue, $pool->clear($key));
83+
$this->assertEquals($returnValue, $pool->clear());
8684
}
8785

8886
public function testDeleteItem()
@@ -91,7 +89,7 @@ public function testDeleteItem()
9189
$key = 'key';
9290
$returnValue = true;
9391

94-
$stub = $this->getHierarchyCacheStub();
92+
$stub = $this->getCacheStub();
9593
$stub->expects($this->once())->method('deleteItem')->with($prefix.$key)->willReturn($returnValue);
9694

9795
$pool = new PrefixedCachePool($stub, $prefix);
@@ -105,7 +103,7 @@ public function testDeleteItems()
105103
$key1 = 'key1';
106104
$returnValue = true;
107105

108-
$stub = $this->getHierarchyCacheStub();
106+
$stub = $this->getCacheStub();
109107
$stub->expects($this->once())->method('deleteItems')->with([$prefix.$key0, $prefix.$key1])->willReturn($returnValue);
110108

111109
$pool = new PrefixedCachePool($stub, $prefix);
@@ -114,11 +112,12 @@ public function testDeleteItems()
114112

115113
public function testSave()
116114
{
115+
/** @type CacheItemInterface $item */
117116
$item = $this->getMockBuilder(CacheItemInterface::class)->getMock();
118117
$prefix = 'ns';
119118
$returnValue = true;
120119

121-
$stub = $this->getHierarchyCacheStub();
120+
$stub = $this->getCacheStub();
122121
$stub->expects($this->once())->method('save')->with($item)->willReturn($returnValue);
123122

124123
$pool = new PrefixedCachePool($stub, $prefix);
@@ -127,11 +126,12 @@ public function testSave()
127126

128127
public function testSaveDeffered()
129128
{
129+
/** @type CacheItemInterface $item */
130130
$item = $this->getMockBuilder(CacheItemInterface::class)->getMock();
131131
$prefix = 'ns';
132132
$returnValue = true;
133133

134-
$stub = $this->getHierarchyCacheStub();
134+
$stub = $this->getCacheStub();
135135
$stub->expects($this->once())->method('saveDeferred')->with($item)->willReturn($returnValue);
136136

137137
$pool = new PrefixedCachePool($stub, $prefix);
@@ -143,7 +143,7 @@ public function testCommit()
143143
$prefix = 'ns';
144144
$returnValue = true;
145145

146-
$stub = $this->getHierarchyCacheStub();
146+
$stub = $this->getCacheStub();
147147
$stub->expects($this->once())->method('commit')->willReturn($returnValue);
148148

149149
$pool = new PrefixedCachePool($stub, $prefix);

composer.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
{
2-
"name": "cache/prefixed-cache",
3-
"description": "A decorator that makes your cache support prefix",
4-
"type": "library",
5-
"license": "MIT",
2+
"name": "cache/prefixed-cache",
3+
"description": "A decorator that makes your cache support prefix",
4+
"type": "library",
5+
"license": "MIT",
66
"minimum-stability": "dev",
7-
"keywords": [
7+
"prefer-stable": true,
8+
"keywords": [
89
"cache",
910
"psr-6",
1011
"prefix"
1112
],
12-
"homepage": "http://www.php-cache.com/en/latest/",
13-
"authors": [
13+
"homepage": "http://www.php-cache.com/en/latest/",
14+
"authors": [
1415
{
15-
"name": "Tobias Nyholm",
16-
"email": "[email protected]",
16+
"name": "Tobias Nyholm",
17+
"email": "[email protected]",
1718
"homepage": "https://github.com/nyholm"
1819
}
1920
],
@@ -23,12 +24,12 @@
2324
"psr/simple-cache": "^1.0",
2425
"cache/hierarchical-cache": "^0.4"
2526
},
26-
"require-dev": {
27-
"phpunit/phpunit": "^4.0 || ^5.1",
27+
"require-dev": {
28+
"phpunit/phpunit": "^5.7.21",
2829
"cache/integration-tests": "^0.16"
2930
},
30-
"autoload": {
31-
"psr-4": {
31+
"autoload": {
32+
"psr-4": {
3233
"Cache\\Prefixed\\": ""
3334
},
3435
"exclude-from-classmap": [
@@ -37,7 +38,7 @@
3738
},
3839
"extra": {
3940
"branch-alias": {
40-
"dev-master": "0.2-dev"
41+
"dev-master": "1.0-dev"
4142
}
4243
}
4344
}

0 commit comments

Comments
 (0)