@@ -49,13 +49,13 @@ function it_caches_responses(CacheItemPoolInterface $pool, CacheItemInterface $i
49
49
$ item ->isHit ()->willReturn (false );
50
50
$ item ->expiresAfter (1060 )->willReturn ($ item )->shouldBeCalled ();
51
51
52
- $ item ->set (Argument:: that ( $ this ->getCacheItemMatcher ([
52
+ $ item ->set ($ this ->getCacheItemMatcher ([
53
53
'response ' => $ response ->getWrappedObject (),
54
54
'body ' => $ httpBody ,
55
55
'expiresAt ' => 0 ,
56
56
'createdAt ' => 0 ,
57
57
'etag ' => []
58
- ]))) ->willReturn ($ item )->shouldBeCalled ();
58
+ ]))->willReturn ($ item )->shouldBeCalled ();
59
59
$ pool ->save (Argument::any ())->shouldBeCalled ();
60
60
61
61
$ next = function (RequestInterface $ request ) use ($ response ) {
@@ -115,13 +115,13 @@ function it_calculate_age_from_response(CacheItemPoolInterface $pool, CacheItemI
115
115
$ pool ->getItem ('e3b717d5883a45ef9493d009741f7c64 ' )->shouldBeCalled ()->willReturn ($ item );
116
116
$ item ->isHit ()->willReturn (false );
117
117
118
- $ item ->set (Argument:: that ( $ this ->getCacheItemMatcher ([
118
+ $ item ->set ($ this ->getCacheItemMatcher ([
119
119
'response ' => $ response ->getWrappedObject (),
120
120
'body ' => $ httpBody ,
121
121
'expiresAt ' => 0 ,
122
122
'createdAt ' => 0 ,
123
123
'etag ' => []
124
- ]))) ->willReturn ($ item )->shouldBeCalled ();
124
+ ]))->willReturn ($ item )->shouldBeCalled ();
125
125
// 40-15 should be 25 + the default 1000
126
126
$ item ->expiresAfter (1025 )->willReturn ($ item )->shouldBeCalled ();
127
127
$ pool ->save ($ item )->shouldBeCalled ();
@@ -133,9 +133,17 @@ function it_calculate_age_from_response(CacheItemPoolInterface $pool, CacheItemI
133
133
$ this ->handleRequest ($ request , $ next , function () {});
134
134
}
135
135
136
+
137
+ /**
138
+ * Private function to match requests
139
+ *
140
+ * @param array $expectedData
141
+ *
142
+ * @return \Closure
143
+ */
136
144
private function getCacheItemMatcher (array $ expectedData )
137
145
{
138
- return function (array $ actualData ) use ($ expectedData ) {
146
+ return Argument:: that ( function (array $ actualData ) use ($ expectedData ) {
139
147
foreach ($ expectedData as $ key => $ value ) {
140
148
if (!isset ($ actualData [$ key ])) {
141
149
return false ;
@@ -151,6 +159,6 @@ private function getCacheItemMatcher(array $expectedData)
151
159
}
152
160
}
153
161
return true ;
154
- };
162
+ }) ;
155
163
}
156
164
}
0 commit comments