Skip to content

Commit 0c845d5

Browse files
committed
merged 2.1
2 parents 1087c9b + 75ec136 commit 0c845d5

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,9 +17,13 @@ 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\Test\Test'));
@@ -32,20 +36,22 @@ public function testConflictsWithAPI()
3236
$this->assertEquals('Codeception\Lib\Interfaces\API', $this->module->_conflicts());
3337
}
3438

35-
public function testXmlIsBuilt() {
39+
public function testXmlIsBuilt()
40+
{
3641
$dom = new \DOMDocument();
3742
$dom->load($this->layout);
3843
$this->assertEqualXMLStructure($this->module->xmlRequest->documentElement, $dom->documentElement);
3944
$this->assertXmlStringEqualsXmlString($dom->saveXML(), $this->module->xmlRequest->saveXML());
4045
}
4146

42-
public function testBuildHeaders() {
47+
public function testBuildHeaders()
48+
{
4349
$this->module->haveSoapHeader('AuthHeader', ['username' => 'davert', 'password' => '123456']);
4450
$dom = new \DOMDocument();
4551
$dom->load($this->layout);
4652
$header = $dom->createElement('AuthHeader');
47-
$header->appendChild($dom->createElement('username','davert'));
48-
$header->appendChild($dom->createElement('password','123456'));
53+
$header->appendChild($dom->createElement('username', 'davert'));
54+
$header->appendChild($dom->createElement('password', '123456'));
4955
$dom->documentElement->getElementsByTagName('Header')->item(0)->appendChild($header);
5056
$this->assertEqualXMLStructure($this->module->xmlRequest->documentElement, $dom->documentElement);
5157
}
@@ -57,20 +63,21 @@ public function testBuildRequest()
5763
$dom = new \DOMDocument();
5864
$dom->load($this->layout);
5965
$body = $dom->createElement('item');
60-
$body->appendChild($dom->createElement('id',1));
61-
$body->appendChild($dom->createElement('subitem',2));
66+
$body->appendChild($dom->createElement('id', 1));
67+
$body->appendChild($dom->createElement('subitem', 2));
6268
$request = $dom->createElement('ns:KillHumans');
6369
$request->appendChild($body);
6470
$dom->documentElement->getElementsByTagName('Body')->item(0)->appendChild($request);
6571
$this->assertEqualXMLStructure($this->module->xmlRequest->documentElement, $dom->documentElement);
6672
}
6773

68-
public function testBuildRequestWithDomNode() {
74+
public function testBuildRequestWithDomNode()
75+
{
6976
$dom = new \DOMDocument();
7077
$dom->load($this->layout);
7178
$body = $dom->createElement('item');
72-
$body->appendChild($dom->createElement('id',1));
73-
$body->appendChild($dom->createElement('subitem',2));
79+
$body->appendChild($dom->createElement('id', 1));
80+
$body->appendChild($dom->createElement('subitem', 2));
7481
$request = $dom->createElement('ns:KillHumans');
7582
$request->appendChild($body);
7683
$dom->documentElement->getElementsByTagName('Body')->item(0)->appendChild($request);
@@ -79,23 +86,26 @@ public function testBuildRequestWithDomNode() {
7986
$this->assertEqualXMLStructure($this->module->xmlRequest->documentElement, $dom->documentElement);
8087
}
8188

82-
public function testSeeXmlIncludes() {
89+
public function testSeeXmlIncludes()
90+
{
8391
$dom = new DOMDocument();
8492
$this->module->xmlResponse = $dom;
8593
$dom->preserveWhiteSpace = false;
8694
$dom->loadXML('<?xml version="1.0" encoding="UTF-8"?> <doc> <a a2="2" a1="1" >123</a> </doc>');
8795
$this->module->seeSoapResponseIncludes('<a a2="2" a1="1" >123</a>');
8896
}
8997

90-
public function testSeeXmlContainsXPath() {
98+
public function testSeeXmlContainsXPath()
99+
{
91100
$dom = new DOMDocument();
92101
$this->module->xmlResponse = $dom;
93102
$dom->preserveWhiteSpace = false;
94103
$dom->loadXML('<?xml version="1.0" encoding="UTF-8"?> <doc> <a a2="2" a1="1" >123</a> </doc>');
95104
$this->module->seeSoapResponseContainsXPath('//doc/a[@a2=2 and @a1=1]');
96105
}
97106

98-
public function testSeeXmlNotContainsXPath() {
107+
public function testSeeXmlNotContainsXPath()
108+
{
99109
$dom = new DOMDocument();
100110
$this->module->xmlResponse = $dom;
101111
$dom->preserveWhiteSpace = false;
@@ -104,7 +114,8 @@ public function testSeeXmlNotContainsXPath() {
104114
}
105115

106116

107-
public function testSeeXmlEquals() {
117+
public function testSeeXmlEquals()
118+
{
108119
$dom = new DOMDocument();
109120
$this->module->xmlResponse = $dom;
110121
$xml = '<?xml version="1.0" encoding="UTF-8"?> <doc> <a a2="2" a1="1" >123</a> </doc>';
@@ -113,18 +124,20 @@ public function testSeeXmlEquals() {
113124
$this->module->seeSoapResponseEquals($xml);
114125
}
115126

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

127-
public function testGrabTextFrom() {
139+
public function testGrabTextFrom()
140+
{
128141
$dom = new DOMDocument();
129142
$this->module->xmlResponse = $dom;
130143
$dom->loadXML('<?xml version="1.0" encoding="UTF-8"?><doc><node>123</node></doc>');
@@ -133,5 +146,4 @@ public function testGrabTextFrom() {
133146
$res = $this->module->grabTextContentFrom('descendant-or-self::doc/descendant::node');
134147
$this->assertEquals('123', $res);
135148
}
136-
137149
}

0 commit comments

Comments
 (0)