@@ -29,7 +29,7 @@ public function setup()
2929
3030 public  function  testShouldInterceptCallWhenEnabled ()
3131 {
32-  $ this soapHook ->enable ($ this getTestCallback ());
32+  $ this soapHook ->enable ($ this getContentCheckCallback ());
3333
3434 $ clientnew  \SoapClient ('http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL ' , array ('soap_version '  => SOAP_1_2 ));
3535 $ clientsetLibraryHook ($ this soapHook );
@@ -52,16 +52,56 @@ public function testShouldNotInterceptCallWhenDisabled()
5252 $ this assertInstanceOf ('\stdClass ' , $ actual'Response was not returned. ' );
5353 }
5454
55+  public  function  testShouldHandleSOAPVersion11 ()
56+  {
57+  $ expectedHeader'text/xml; charset=utf-8; action="http://ws.cdyne.com/WeatherWS/GetCityWeatherByZIP" ' ;
58+  $ this soapHook ->enable ($ this getHeaderCheckCallback ($ expectedHeader
59+ 
60+  $ clientnew  \SoapClient (
61+  'http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL ' ,
62+  array ('soap_version '  => SOAP_1_1 )
63+  );
64+  $ clientsetLibraryHook ($ this soapHook );
65+  $ clientGetCityWeatherByZIP (array ('ZIP '  => '10013 ' ));
66+  }
67+ 
68+  public  function  testShouldHandleSOAPVersion12 ()
69+  {
70+  $ expectedHeader'application/soap+xml; charset=utf-8; action="http://ws.cdyne.com/WeatherWS/GetCityWeatherByZIP" ' ;
71+  $ this soapHook ->enable ($ this getHeaderCheckCallback ($ expectedHeader
72+ 
73+  $ clientnew  \SoapClient (
74+  'http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL ' ,
75+  array ('soap_version '  => SOAP_1_2 )
76+  );
77+  $ clientsetLibraryHook ($ this soapHook );
78+  $ clientGetCityWeatherByZIP (array ('ZIP '  => '10013 ' ));
79+  }
80+ 
5581 /** 
5682 * @param null $handleRequestCallback 
5783 * 
5884 * @return \callable 
5985 */ 
60-  protected  function  getTestCallback ( $ handleRequestCallback  =  null )
86+  protected  function  getContentCheckCallback ( )
6187 {
6288 $ testClass$ this 
63-  return  function ( $ request use ($ testClass
89+  return  function  ( ) use   ($ testClass
6490 return  new  Response (200 , null , $ testClassexpected );
6591 };
6692 }
93+ 
94+  /** 
95+  * @param null $handleRequestCallback 
96+  * 
97+  * @return \callable 
98+  */ 
99+  protected  function  getHeaderCheckCallback ($ expectedHeader
100+  {
101+  $ test$ this 
102+  return  function  ($ requestuse  ($ test$ expectedHeader
103+  $ testassertEquals ($ expectedHeader$ requestgetHeader ('Content-Type ' ));
104+  return  new  Response (200 , null , '' );
105+  };
106+  }
67107}
0 commit comments