Skip to content

Commit 2f584c6

Browse files
authored
[Prefix] Prepare for stable release (#186)
* Prepare for stable release * Applied changes from StyleCI
1 parent 3cb339c commit 2f584c6

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
],
2121
"require": {
2222
"php": "^5.6 || ^7.0",
23-
"psr/cache": "^1.0",
24-
"cache/hierarchical-cache": "^1.0"
23+
"psr/cache": "^1.0"
2524
},
2625
"require-dev": {
2726
"phpunit/phpunit": "^5.7.21",

0 commit comments

Comments
 (0)