Skip to content

Commit c779149

Browse files
committed
Style fix
1 parent 31837ab commit c779149

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

spec/CachePluginSpec.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ function it_caches_responses(CacheItemPoolInterface $pool, CacheItemInterface $i
4949
$item->isHit()->willReturn(false);
5050
$item->expiresAfter(1060)->willReturn($item)->shouldBeCalled();
5151

52-
$item->set(Argument::that($this->getCacheItemMatcher([
52+
$item->set($this->getCacheItemMatcher([
5353
'response' => $response->getWrappedObject(),
5454
'body' => $httpBody,
5555
'expiresAt' => 0,
5656
'createdAt' => 0,
5757
'etag' => []
58-
])))->willReturn($item)->shouldBeCalled();
58+
]))->willReturn($item)->shouldBeCalled();
5959
$pool->save(Argument::any())->shouldBeCalled();
6060

6161
$next = function (RequestInterface $request) use ($response) {
@@ -115,13 +115,13 @@ function it_calculate_age_from_response(CacheItemPoolInterface $pool, CacheItemI
115115
$pool->getItem('e3b717d5883a45ef9493d009741f7c64')->shouldBeCalled()->willReturn($item);
116116
$item->isHit()->willReturn(false);
117117

118-
$item->set(Argument::that($this->getCacheItemMatcher([
118+
$item->set($this->getCacheItemMatcher([
119119
'response' => $response->getWrappedObject(),
120120
'body' => $httpBody,
121121
'expiresAt' => 0,
122122
'createdAt' => 0,
123123
'etag' => []
124-
])))->willReturn($item)->shouldBeCalled();
124+
]))->willReturn($item)->shouldBeCalled();
125125
// 40-15 should be 25 + the default 1000
126126
$item->expiresAfter(1025)->willReturn($item)->shouldBeCalled();
127127
$pool->save($item)->shouldBeCalled();
@@ -133,9 +133,17 @@ function it_calculate_age_from_response(CacheItemPoolInterface $pool, CacheItemI
133133
$this->handleRequest($request, $next, function () {});
134134
}
135135

136+
137+
/**
138+
* Private function to match requests
139+
*
140+
* @param array $expectedData
141+
*
142+
* @return \Closure
143+
*/
136144
private function getCacheItemMatcher(array $expectedData)
137145
{
138-
return function(array $actualData) use ($expectedData) {
146+
return Argument::that(function(array $actualData) use ($expectedData) {
139147
foreach ($expectedData as $key => $value) {
140148
if (!isset($actualData[$key])) {
141149
return false;
@@ -151,6 +159,6 @@ private function getCacheItemMatcher(array $expectedData)
151159
}
152160
}
153161
return true;
154-
};
162+
});
155163
}
156164
}

0 commit comments

Comments
 (0)