File tree Expand file tree Collapse file tree 5 files changed +34
-4
lines changed Expand file tree Collapse file tree 5 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 45454646 },
4747 "require" : {
48- "php" : " >=5.4"
48+ "php" : " >=5.4" ,
49+ "ext-soap" : " *"
4950 },
5051 "scripts" : {
5152 "test" : " vendor/bin/phpunit" ,
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 22
33namespace WsdlToPhp \PackageBase \Tests ;
44
5+ use SoapFault ;
56use WsdlToPhp \PackageBase \AbstractSoapClientBase ;
67
78class 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 }
Original file line number Diff line number Diff line change 33namespace WsdlToPhp \PackageBase \Tests ;
44
55use WsdlToPhp \PackageBase \Utils ;
6- use WsdlToPhp \PackageBase \Tests \SoapClient ;
76
87class 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}
You can’t perform that action at this time.
0 commit comments