99use CodeDredd \Soap \SoapFactory ;
1010use CodeDredd \Soap \Tests \Fixtures \CustomSoapClient ;
1111use CodeDredd \Soap \Tests \TestCase ;
12+ use GuzzleHttp \RedirectMiddleware ;
1213
1314class SoapClientTest extends TestCase
1415{
@@ -77,7 +78,7 @@ public function testRequestWithArguments()
7778 self ::assertTrue ($ response ->ok ());
7879 Soap::assertSent (function (Request $ request ) use ($ arguments ) {
7980 return $ request ->arguments () === $ arguments &&
80- $ request ->action () === 'Submit_User ' ;
81+ $ request ->action () === 'Submit_User ' ;
8182 });
8283 }
8384
@@ -149,7 +150,8 @@ public function testSoapOptions(): void
149150 $ lastRequestInfo = $ client ->getEngine ()->collectLastRequestInfo ();
150151
151152 self ::assertTrue ($ response ->ok ());
152- self ::assertStringContainsString ('application/soap+xml; charset="utf-8 ' , $ lastRequestInfo ->getLastRequestHeaders ());
153+ self ::assertStringContainsString ('application/soap+xml; charset="utf-8 ' ,
154+ $ lastRequestInfo ->getLastRequestHeaders ());
153155 Soap::assertActionCalled ('Get_User ' );
154156 }
155157
@@ -158,10 +160,10 @@ public function testRealSoapCall(): void
158160 $ this ->markTestSkipped ('Real Soap Call Testing. Comment the line out for testing ' );
159161 // location has to be set because the wsdl has a wrong location declaration
160162 $ client = Soap::baseWsdl ('https://www.w3schools.com/xml/tempconvert.asmx?wsdl ' )
161- ->withOptions ([
162- 'soap_version ' => SOAP_1_2 ,
163- 'location ' => 'https://www.w3schools.com/xml/tempconvert.asmx?wsdl ' ,
164- ]);
163+ ->withOptions ([
164+ 'soap_version ' => SOAP_1_2 ,
165+ 'location ' => 'https://www.w3schools.com/xml/tempconvert.asmx?wsdl ' ,
166+ ]);
165167 $ result = $ client ->call ('FahrenheitToCelsius ' , [
166168 'Fahrenheit ' => 75 ,
167169 ]);
@@ -211,4 +213,24 @@ public function testSoapClientClassMayBeCustomized(): void
211213 $ client = Soap::buildClient ('laravel_soap ' );
212214 $ this ->assertInstanceOf (CustomSoapClient::class, $ client );
213215 }
216+
217+ public function testHandlerOptions (): void
218+ {
219+ Soap::fake ();
220+ $ client = Soap::baseWsdl ('https://laravel-soap.wsdl ' );
221+ $ response = $ client ->call ('Get_User ' );
222+ self ::assertTrue ($ response ->ok ());
223+ self ::assertEquals (true , $ client ->getHandler ()->getClient ()->getConfig ()['verify ' ]);
224+ $ client = $ client ->withHandlerOptions ([
225+ 'allow_redirects ' => RedirectMiddleware::$ defaultSettings ,
226+ 'http_errors ' => true ,
227+ 'decode_content ' => true ,
228+ 'verify ' => false ,
229+ 'cookies ' => false ,
230+ 'idn_conversion ' => false ,
231+ ]);
232+ $ response = $ client ->call ('Get_User ' );
233+ self ::assertTrue ($ response ->ok ());
234+ self ::assertEquals (false , $ client ->getHandler ()->getClient ()->getConfig ()['verify ' ]);
235+ }
214236}
0 commit comments