Skip to content

Commit 5c933bb

Browse files
committed
add unit test for setHttpHeader method
1 parent add48dc commit 5c933bb

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

AbstractSoapClientBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ public function setHttpHeader($headerName, $headerValue)
482482
/**
483483
* Add new header entry
484484
*/
485-
array_push($newLines, "$headerName: $headerValue");
485+
array_push($newLines, "$headerName: $headerValue");
486486
/**
487487
* Set the context http header option
488488
*/

Tests/SoapClientTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,26 @@ public function testSetGetResult()
194194

195195
$this->assertNull($soapClient->getResult());
196196
}
197+
/**
198+
*
199+
*/
200+
public function testSetHeaders()
201+
{
202+
$soapClient = new SoapClient(array(
203+
SoapClient::WSDL_URL => __DIR__ . '/resources/bingsearch.wsdl',
204+
SoapClient::WSDL_CLASSMAP => self::classMap(),
205+
));
206+
207+
$this->assertTrue($soapClient->setHttpHeader('X-Header-Name', 'X-Header-Value'));
208+
209+
$this->assertTrue(is_resource(SoapClient::getSoapClient()->_stream_context));
210+
211+
$this->assertSame(array(
212+
'http' => array(
213+
'header' => 'X-Header-Name: X-Header-Value',
214+
),
215+
), stream_context_get_options(SoapClient::getSoapClient()->_stream_context));
216+
}
197217
/**
198218
* @return string[]
199219
*/

0 commit comments

Comments
 (0)