@@ -115,15 +115,7 @@ public function testClearHeaderIfHeaderExistsAndWasFound()
115
115
116
116
$ this ->headers ->addHeaderLine ('Header-name: header-value ' );
117
117
118
- $ header = $ this ->getMock (
119
- 'Zend\Http\Header\GenericHeader ' ,
120
- ['getFieldName ' ],
121
- ['Header-name ' , 'header-value ' ]
122
- );
123
- $ header
124
- ->expects ($ this ->once ())
125
- ->method ('getFieldName ' )
126
- ->will ($ this ->returnValue ('Header-name ' ));
118
+ $ header = \Zend \Http \Header \GenericHeader::fromString ('Header-name: header-value ' );
127
119
128
120
$ this ->headers
129
121
->expects ($ this ->once ())
@@ -132,7 +124,8 @@ public function testClearHeaderIfHeaderExistsAndWasFound()
132
124
->will ($ this ->returnValue (true ));
133
125
$ this ->headers
134
126
->expects ($ this ->once ())
135
- ->method ('current ' )
127
+ ->method ('get ' )
128
+ ->with ('Header-name ' )
136
129
->will ($ this ->returnValue ($ header ));
137
130
$ this ->headers
138
131
->expects ($ this ->once ())
@@ -148,47 +141,6 @@ public function testClearHeaderIfHeaderExistsAndWasFound()
148
141
$ response ->clearHeader ('Header-name ' );
149
142
}
150
143
151
- public function testClearHeaderIfHeaderExistsAndWasNotFound ()
152
- {
153
- $ response = $ this ->response = $ this ->getMock (
154
- 'Magento\Framework\HTTP\PhpEnvironment\Response ' ,
155
- ['getHeaders ' , 'send ' ]
156
- );
157
-
158
- $ this ->headers ->addHeaderLine ('Header-name: header-value ' );
159
-
160
- $ header = $ this ->getMock (
161
- 'Zend\Http\Header\GenericHeader ' ,
162
- ['getFieldName ' ],
163
- ['Header-name ' , 'header-value ' ]
164
- );
165
- $ header
166
- ->expects ($ this ->once ())
167
- ->method ('getFieldName ' )
168
- ->will ($ this ->returnValue ('Wrong-header-name ' ));
169
-
170
- $ this ->headers
171
- ->expects ($ this ->once ())
172
- ->method ('has ' )
173
- ->with ('Header-name ' )
174
- ->will ($ this ->returnValue (true ));
175
- $ this ->headers
176
- ->expects ($ this ->once ())
177
- ->method ('current ' )
178
- ->will ($ this ->returnValue ($ header ));
179
- $ this ->headers
180
- ->expects ($ this ->never ())
181
- ->method ('removeHeader ' )
182
- ->with ($ header );
183
-
184
- $ response
185
- ->expects ($ this ->once ())
186
- ->method ('getHeaders ' )
187
- ->will ($ this ->returnValue ($ this ->headers ));
188
-
189
- $ response ->clearHeader ('Header-name ' );
190
- }
191
-
192
144
public function testClearHeaderAndHeaderNotExists ()
193
145
{
194
146
$ response = $ this ->response = $ this ->getMock (
@@ -198,15 +150,7 @@ public function testClearHeaderAndHeaderNotExists()
198
150
199
151
$ this ->headers ->addHeaderLine ('Header-name: header-value ' );
200
152
201
- $ header = $ this ->getMock (
202
- 'Zend\Http\Header\GenericHeader ' ,
203
- ['getFieldName ' ],
204
- ['Header-name ' , 'header-value ' ]
205
- );
206
- $ header
207
- ->expects ($ this ->never ())
208
- ->method ('getFieldName ' )
209
- ->will ($ this ->returnValue ('Wrong-header-name ' ));
153
+ $ header = \Zend \Http \Header \GenericHeader::fromString ('Header-name: header-value ' );
210
154
211
155
$ this ->headers
212
156
->expects ($ this ->once ())
@@ -215,7 +159,8 @@ public function testClearHeaderAndHeaderNotExists()
215
159
->will ($ this ->returnValue (false ));
216
160
$ this ->headers
217
161
->expects ($ this ->never ())
218
- ->method ('current ' )
162
+ ->method ('get ' )
163
+ ->with ('Header-name ' )
219
164
->will ($ this ->returnValue ($ header ));
220
165
$ this ->headers
221
166
->expects ($ this ->never ())
0 commit comments