Skip to content

Commit 75ec136

Browse files
MAXakaWIZARDDavertMik
authored andcommitted
PSR-2 compliance (#3105)
* Add composer.lock to .gitignore * Put direct link to coding standards description * Fix spacing * Fix code style for ext and symfony-shim * Fix PSR2 compliance issues * Fix PSR2 compliance issues * Add generated test files to gitginore * Fix PSR2 compliance issues in tests * Get rid of long code lines in tests to comply PSR2 * Get rid of long code lines to comply PSR2 * Add code style rule set * Fix wrong indentation * Improve code style
1 parent 4c9b0f1 commit 75ec136

File tree

1 file changed

+32
-20
lines changed

1 file changed

+32
-20
lines changed

tests/unit/Codeception/Module/SoapTest.php

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,35 @@ class SoapTest extends \PHPUnit_Framework_TestCase
1717

1818
protected $layout;
1919

20-
public function setUp() {
20+
public function setUp()
21+
{
2122
$this->module = new \Codeception\Module\SOAP(make_container());
22-
$this->module->_setConfig(array('schema' => 'http://www.w3.org/2001/xml.xsd', 'endpoint' => 'http://codeception.com/api/wsdl'));
23+
$this->module->_setConfig(array(
24+
'schema' => 'http://www.w3.org/2001/xml.xsd',
25+
'endpoint' => 'http://codeception.com/api/wsdl'
26+
));
2327
$this->layout = \Codeception\Configuration::dataDir().'/xml/layout.xml';
2428
$this->module->isFunctional = true;
2529
$this->module->_before(Stub::makeEmpty('\Codeception\TestCase\Cept'));
2630
$this->module->client = Stub::makeEmpty('\Codeception\Lib\Connector\Universal');
2731
}
2832

29-
public function testXmlIsBuilt() {
33+
public function testXmlIsBuilt()
34+
{
3035
$dom = new \DOMDocument();
3136
$dom->load($this->layout);
3237
$this->assertEqualXMLStructure($this->module->xmlRequest->documentElement, $dom->documentElement);
3338
$this->assertXmlStringEqualsXmlString($dom->saveXML(), $this->module->xmlRequest->saveXML());
3439
}
3540

36-
public function testBuildHeaders() {
41+
public function testBuildHeaders()
42+
{
3743
$this->module->haveSoapHeader('AuthHeader', ['username' => 'davert', 'password' => '123456']);
3844
$dom = new \DOMDocument();
3945
$dom->load($this->layout);
4046
$header = $dom->createElement('AuthHeader');
41-
$header->appendChild($dom->createElement('username','davert'));
42-
$header->appendChild($dom->createElement('password','123456'));
47+
$header->appendChild($dom->createElement('username', 'davert'));
48+
$header->appendChild($dom->createElement('password', '123456'));
4349
$dom->documentElement->getElementsByTagName('Header')->item(0)->appendChild($header);
4450
$this->assertEqualXMLStructure($this->module->xmlRequest->documentElement, $dom->documentElement);
4551
}
@@ -51,20 +57,21 @@ public function testBuildRequest()
5157
$dom = new \DOMDocument();
5258
$dom->load($this->layout);
5359
$body = $dom->createElement('item');
54-
$body->appendChild($dom->createElement('id',1));
55-
$body->appendChild($dom->createElement('subitem',2));
60+
$body->appendChild($dom->createElement('id', 1));
61+
$body->appendChild($dom->createElement('subitem', 2));
5662
$request = $dom->createElement('ns:KillHumans');
5763
$request->appendChild($body);
5864
$dom->documentElement->getElementsByTagName('Body')->item(0)->appendChild($request);
5965
$this->assertEqualXMLStructure($this->module->xmlRequest->documentElement, $dom->documentElement);
6066
}
6167

62-
public function testBuildRequestWithDomNode() {
68+
public function testBuildRequestWithDomNode()
69+
{
6370
$dom = new \DOMDocument();
6471
$dom->load($this->layout);
6572
$body = $dom->createElement('item');
66-
$body->appendChild($dom->createElement('id',1));
67-
$body->appendChild($dom->createElement('subitem',2));
73+
$body->appendChild($dom->createElement('id', 1));
74+
$body->appendChild($dom->createElement('subitem', 2));
6875
$request = $dom->createElement('ns:KillHumans');
6976
$request->appendChild($body);
7077
$dom->documentElement->getElementsByTagName('Body')->item(0)->appendChild($request);
@@ -73,23 +80,26 @@ public function testBuildRequestWithDomNode() {
7380
$this->assertEqualXMLStructure($this->module->xmlRequest->documentElement, $dom->documentElement);
7481
}
7582

76-
public function testSeeXmlIncludes() {
83+
public function testSeeXmlIncludes()
84+
{
7785
$dom = new DOMDocument();
7886
$this->module->xmlResponse = $dom;
7987
$dom->preserveWhiteSpace = false;
8088
$dom->loadXML('<?xml version="1.0" encoding="UTF-8"?> <doc> <a a2="2" a1="1" >123</a> </doc>');
8189
$this->module->seeSoapResponseIncludes('<a a2="2" a1="1" >123</a>');
8290
}
8391

84-
public function testSeeXmlContainsXPath() {
92+
public function testSeeXmlContainsXPath()
93+
{
8594
$dom = new DOMDocument();
8695
$this->module->xmlResponse = $dom;
8796
$dom->preserveWhiteSpace = false;
8897
$dom->loadXML('<?xml version="1.0" encoding="UTF-8"?> <doc> <a a2="2" a1="1" >123</a> </doc>');
8998
$this->module->seeSoapResponseContainsXPath('//doc/a[@a2=2 and @a1=1]');
9099
}
91100

92-
public function testSeeXmlNotContainsXPath() {
101+
public function testSeeXmlNotContainsXPath()
102+
{
93103
$dom = new DOMDocument();
94104
$this->module->xmlResponse = $dom;
95105
$dom->preserveWhiteSpace = false;
@@ -98,7 +108,8 @@ public function testSeeXmlNotContainsXPath() {
98108
}
99109

100110

101-
public function testSeeXmlEquals() {
111+
public function testSeeXmlEquals()
112+
{
102113
$dom = new DOMDocument();
103114
$this->module->xmlResponse = $dom;
104115
$xml = '<?xml version="1.0" encoding="UTF-8"?> <doc> <a a2="2" a1="1" >123</a> </doc>';
@@ -107,18 +118,20 @@ public function testSeeXmlEquals() {
107118
$this->module->seeSoapResponseEquals($xml);
108119
}
109120

110-
public function testSeeXmlIncludesWithBuilder() {
121+
public function testSeeXmlIncludesWithBuilder()
122+
{
111123
$dom = new DOMDocument();
112124
$this->module->xmlResponse = $dom;
113125
$dom->loadXML('<?xml version="1.0" encoding="UTF-8"?>'."\n".' <doc><a a2="2" a1="1" >123</a></doc>');
114126
$xml = SoapUtil::request()->doc->a
115-
->attr('a2','2')
116-
->attr('a1','1')
127+
->attr('a2', '2')
128+
->attr('a1', '1')
117129
->val('123');
118130
$this->module->seeSoapResponseIncludes($xml);
119131
}
120132

121-
public function testGrabTextFrom() {
133+
public function testGrabTextFrom()
134+
{
122135
$dom = new DOMDocument();
123136
$this->module->xmlResponse = $dom;
124137
$dom->loadXML('<?xml version="1.0" encoding="UTF-8"?><doc><node>123</node></doc>');
@@ -127,5 +140,4 @@ public function testGrabTextFrom() {
127140
$res = $this->module->grabTextContentFrom('descendant-or-self::doc/descendant::node');
128141
$this->assertEquals('123', $res);
129142
}
130-
131143
}

0 commit comments

Comments
 (0)