@@ -98,10 +98,12 @@ public function loadProvider()
98
98
];
99
99
}
100
100
101
- public function testProcessSaveCache ()
101
+ /**
102
+ * @param $httpCode
103
+ * @dataProvider testProcessSaveCacheDataProvider
104
+ */
105
+ public function testProcessSaveCache ($ httpCode , $ at )
102
106
{
103
- $ httpCode = 200 ;
104
-
105
107
$ cacheControlHeader = \Zend \Http \Header \CacheControl::fromString (
106
108
'Cache-Control: public, max-age=100, s-maxage=100 '
107
109
);
@@ -116,21 +118,37 @@ public function testProcessSaveCache()
116
118
$ this ->returnValue ($ cacheControlHeader )
117
119
);
118
120
$ this ->responseMock ->expects (
119
- $ this ->once ()
121
+ $ this ->any ()
120
122
)->method (
121
123
'getHttpResponseCode '
122
- )->will (
123
- $ this ->returnValue ($ httpCode )
124
- );
125
- $ this ->requestMock ->expects ($ this ->once ())->method ('isGet ' )->will ($ this ->returnValue (true ));
126
- $ this ->responseMock ->expects ($ this ->once ())->method ('setNoCacheHeaders ' );
127
- $ this ->responseMock ->expects ($ this ->at (3 ))->method ('getHeader ' )->with ('X-Magento-Tags ' );
128
- $ this ->responseMock ->expects ($ this ->at (4 ))->method ('clearHeader ' )->with ($ this ->equalTo ('Set-Cookie ' ));
129
- $ this ->responseMock ->expects ($ this ->at (5 ))->method ('clearHeader ' )->with ($ this ->equalTo ('X-Magento-Tags ' ));
130
- $ this ->cacheMock ->expects ($ this ->once ())->method ('save ' );
124
+ )->willReturn ($ httpCode );
125
+ $ this ->requestMock ->expects ($ this ->once ())
126
+ ->method ('isGet ' )
127
+ ->willReturn (true );
128
+ $ this ->responseMock ->expects ($ this ->once ())
129
+ ->method ('setNoCacheHeaders ' );
130
+ $ this ->responseMock ->expects ($ this ->at ($ at [0 ]))
131
+ ->method ('getHeader ' )
132
+ ->with ('X-Magento-Tags ' );
133
+ $ this ->responseMock ->expects ($ this ->at ($ at [1 ]))
134
+ ->method ('clearHeader ' )
135
+ ->with ($ this ->equalTo ('Set-Cookie ' ));
136
+ $ this ->responseMock ->expects ($ this ->at ($ at [2 ]))
137
+ ->method ('clearHeader ' )
138
+ ->with ($ this ->equalTo ('X-Magento-Tags ' ));
139
+ $ this ->cacheMock ->expects ($ this ->once ())
140
+ ->method ('save ' );
131
141
$ this ->kernel ->process ($ this ->responseMock );
132
142
}
133
143
144
+ public function testProcessSaveCacheDataProvider ()
145
+ {
146
+ return [
147
+ [200 , [3 , 4 , 5 ]],
148
+ [404 , [4 , 5 , 6 ]]
149
+ ];
150
+ }
151
+
134
152
/**
135
153
* @dataProvider processNotSaveCacheProvider
136
154
* @param string $cacheControlHeader
@@ -167,13 +185,11 @@ public function processNotSaveCacheProvider()
167
185
return [
168
186
['private, max-age=100 ' , 200 , true , false ],
169
187
['private, max-age=100 ' , 200 , false , false ],
170
- ['private, max-age=100 ' , 404 , true , false ],
171
188
['private, max-age=100 ' , 500 , true , false ],
172
189
['no-store, no-cache, must-revalidate, max-age=0 ' , 200 , true , false ],
173
190
['no-store, no-cache, must-revalidate, max-age=0 ' , 200 , false , false ],
174
191
['no-store, no-cache, must-revalidate, max-age=0 ' , 404 , true , false ],
175
192
['no-store, no-cache, must-revalidate, max-age=0 ' , 500 , true , false ],
176
- ['public, max-age=100, s-maxage=100 ' , 404 , true , true ],
177
193
['public, max-age=100, s-maxage=100 ' , 500 , true , true ],
178
194
['public, max-age=100, s-maxage=100 ' , 200 , false , true ]
179
195
];
0 commit comments