Skip to content

Commit 3acde5c

Browse files
committed
Merge branch 'release/2.2.0'
2 parents 36a5e92 + 87e784f commit 3acde5c

File tree

5 files changed

+34
-4
lines changed

5 files changed

+34
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# CHANGELOG
22

3-
## 2.0.4 - 2020-05-14
3+
## 2.2.0 - 2020-09-11
4+
- Issue #31 - Add output headers to SoapClient in order to be able to store them
5+
6+
## 2.1.0 - 2020-05-14
47
- Pull request #29 - Transform HTTP headers from stream context options to array
58
- Update Travis CI PHP Matrix
69
- Use better Docker configuration

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
"email" : "[email protected]"
4646
},
4747
"require": {
48-
"php" : ">=5.4"
48+
"php" : ">=5.4",
49+
"ext-soap": "*"
4950
},
5051
"scripts": {
5152
"test": "vendor/bin/phpunit",

src/AbstractSoapClientBase.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ abstract class AbstractSoapClientBase implements SoapClientInterface
1919
* @var array
2020
*/
2121
private $lastError;
22+
/**
23+
* Contains output headers
24+
* @var array
25+
*/
26+
protected $outputHeaders = [];
2227
/**
2328
* Constructor
2429
* @uses AbstractSoapClientBase::setLastError()
@@ -478,6 +483,13 @@ public function setResult($result)
478483
$this->result = $result;
479484
return $this;
480485
}
486+
/**
487+
* @return array
488+
*/
489+
public function getOutputHeaders()
490+
{
491+
return $this->outputHeaders;
492+
}
481493
/**
482494
* Default string representation of current object. Don't want to expose any sensible data
483495
* @return string

tests/SoapClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace WsdlToPhp\PackageBase\Tests;
44

5+
use SoapFault;
56
use WsdlToPhp\PackageBase\AbstractSoapClientBase;
67

78
class SoapClient extends AbstractSoapClientBase
@@ -24,7 +25,7 @@ public function search()
2425
{
2526
try {
2627
$this->getSoapClient()->search();
27-
} catch (\SoapFault $soapFault) {
28+
} catch (SoapFault $soapFault) {
2829
$this->setResult(null);
2930
$this->saveLastError(__METHOD__, $soapFault);
3031
}

tests/SoapClientTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace WsdlToPhp\PackageBase\Tests;
44

55
use WsdlToPhp\PackageBase\Utils;
6-
use WsdlToPhp\PackageBase\Tests\SoapClient;
76

87
class SoapClientTest extends TestCase
98
{
@@ -536,4 +535,18 @@ public function test__toStringMustReturnTheClassNameOfTheInstance()
536535
{
537536
$this->assertSame('WsdlToPhp\PackageBase\Tests\SoapClient', (string) new SoapClient());
538537
}
538+
/**
539+
*
540+
*/
541+
public function testGetOutputHeadersWithoutRequestMustReturnAnEmptyArray()
542+
{
543+
$soapClient = new SoapClient(array(
544+
SoapClient::WSDL_URL => null,
545+
SoapClient::WSDL_LOCATION => 'http://api.bing.net:80/soap.asmx',
546+
SoapClient::WSDL_URI => 'http://api.bing.net:80/soap.asmx',
547+
));
548+
549+
$this->assertTrue(is_array($soapClient->getOutputHeaders()));
550+
$this->assertEmpty($soapClient->getOutputHeaders());
551+
}
539552
}

0 commit comments

Comments
 (0)