11<?php
22namespace Codeception \Module ;
33
4+ use Codeception \Module as CodeceptionModule ;
5+ use Codeception \TestCase ;
6+ use Codeception \Exception \ModuleException ;
7+ use Codeception \Exception \ModuleRequireException ;
8+ use Codeception \Lib \Framework ;
9+ use Codeception \Lib \InnerBrowser ;
10+ use Codeception \Util \Soap as SoapUtils ;
11+ use Codeception \Util \XmlStructure ;
12+
413/**
514 * Module for testing SOAP WSDL web services.
615 * Send requests and check if response matches the pattern.
3140 * * response - last soap response (DOMDocument)
3241 *
3342 */
34-
35- use Codeception \Exception \ModuleException ;
36- use Codeception \Exception \ModuleRequireException ;
37- use Codeception \Lib \Framework ;
38- use Codeception \Lib \InnerBrowser ;
39- use Codeception \Util \Soap as SoapUtils ;
40- use Codeception \Util \XmlStructure ;
41-
42- class SOAP extends \Codeception \Module
43+ class SOAP extends CodeceptionModule
4344{
44-
45+ protected $ config = [
46+ 'schema ' => "" ,
47+ 'schema_url ' => 'http://schemas.xmlsoap.org/soap/envelope/ ' ,
48+ 'framework_collect_buffer ' => true
49+ ];
50+
51+ protected $ requiredFields = ['endpoint ' ];
52+
4553 protected $ dependencyMessage = <<<EOF
4654Example using PhpBrowser as backend for SOAP module.
4755--
@@ -53,9 +61,6 @@ class SOAP extends \Codeception\Module
5361Framework modules can be used as well for functional testing of SOAP API.
5462EOF ;
5563
56-
57- protected $ config = ['schema ' => "" , 'schema_url ' => 'http://schemas.xmlsoap.org/soap/envelope/ ' , 'framework_collect_buffer ' => true ];
58- protected $ requiredFields = ['endpoint ' ];
5964 /**
6065 * @var \Symfony\Component\BrowserKit\Client
6166 */
@@ -81,7 +86,7 @@ class SOAP extends \Codeception\Module
8186 */
8287 protected $ connectionModule ;
8388
84- public function _before (\ Codeception \ TestCase $ test )
89+ public function _before (TestCase $ test )
8590 {
8691 $ this ->client = &$ this ->connectionModule ->client ;
8792 $ this ->buildRequest ();
@@ -377,7 +382,11 @@ public function dontSeeSoapResponseContainsXPath($xpath)
377382 */
378383 public function seeResponseCodeIs ($ code )
379384 {
380- $ this ->assertEquals ($ code , $ this ->client ->getInternalResponse ()->getStatus (), "soap response code matches expected " );
385+ $ this ->assertEquals (
386+ $ code ,
387+ $ this ->client ->getInternalResponse ()->getStatus (),
388+ "soap response code matches expected "
389+ );
381390 }
382391
383392 /**
@@ -446,11 +455,12 @@ protected function processRequest($action, $body)
446455 $ this ->getClient ()->request (
447456 'POST ' ,
448457 $ this ->config ['endpoint ' ],
449- [], [],
458+ [],
459+ [],
450460 [
451- " HTTP_Content-Type " => " text/xml; charset=UTF-8 " ,
461+ ' HTTP_Content-Type ' => ' text/xml; charset=UTF-8 ' ,
452462 'HTTP_Content-Length ' => strlen ($ body ),
453- 'HTTP_SOAPAction ' => $ action
463+ 'HTTP_SOAPAction ' => $ action
454464 ],
455465 $ body
456466 );
@@ -479,5 +489,4 @@ protected function processExternalRequest($action, $body)
479489 $ this ->processRequest ($ action , $ body );
480490 return $ this ->client ->getInternalResponse ()->getContent ();
481491 }
482-
483492}
0 commit comments