Skip to content

Commit 5f11ce1

Browse files
committed
Added package files
1 parent 76d4663 commit 5f11ce1

File tree

14 files changed

+391
-2
lines changed

14 files changed

+391
-2
lines changed

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Exclude files that don't need to be present in packages (so they're not downloaded by Composer)
2+
/tests export-ignore
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
/Robofile.php export-ignore
6+
/*.md export-ignore
7+
/*.yml export-ignore

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.idea/
2+
/vendor/
3+
/composer.lock

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: php
2+
3+
php:
4+
- 5.6
5+
- 7.0
6+
- 7.1
7+
- 7.2
8+
- 7.3
9+
10+
# faster builds on new travis setup not using sudo
11+
sudo: false
12+
13+
install:
14+
- '[[ -z "$CI_USER_TOKEN" ]] || composer config github-oauth.github.com ${CI_USER_TOKEN};'
15+
- travis_retry composer self-update && composer --version
16+
- travis_retry composer update --prefer-dist --no-interaction
17+
18+
script:
19+
- php ./vendor/bin/codecept run

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2011 Michael Bodnarchuk and contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Robofile.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
require __DIR__ . '/vendor/autoload.php';
4+
5+
use Codeception\Module\SOAP;
6+
use Codeception\Util\DocumentationHelpers;
7+
8+
class RoboFile extends \Robo\Tasks
9+
{
10+
use DocumentationHelpers;
11+
12+
public function buildDocs()
13+
{
14+
$className = SOAP::class;
15+
$classPath = str_replace('\\', '/', $className);
16+
$source = "https://github.com/Codeception/module-soap/tree/master/src/$classPath.php";
17+
$sourceMessage = '<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="' . $source . '">Help us to improve documentation. Edit module reference</a></div>';
18+
$documentationFile = 'documentation.md';
19+
$this->generateDocumentationForClass($className, $documentationFile, $sourceMessage);
20+
}
21+
}

codeception.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
paths:
2+
tests: tests
3+
output: tests/_output
4+
data: tests/_data
5+
support: tests/_support
6+
envs: tests/_envs
7+
actor_suffix: Tester

composer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name":"codeception/module-soap",
3+
"description":"Soap module for Codeception",
4+
"keywords":["codeception", "soap"],
5+
"homepage":"http://codeception.com/",
6+
"type":"library",
7+
"license":"MIT",
8+
"authors":[
9+
{
10+
"name":"Michael Bodnarchuk"
11+
}
12+
],
13+
"minimum-stability": "RC",
14+
15+
"require": {
16+
"php": ">=5.6.0 <8.0",
17+
"ext-dom": "*",
18+
"codeception/codeception": "4.0.x-dev | ^4.0",
19+
"codeception/lib-innerbrowser": "^1.0"
20+
},
21+
"require-dev": {
22+
"codeception/util-robohelpers": "dev-master",
23+
"codeception/util-universalframework": "dev-master"
24+
},
25+
"autoload":{
26+
"classmap": ["src/"]
27+
},
28+
"config": {
29+
"classmap-authoritative": true
30+
}
31+
}

documentation.md

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
# SOAP
2+
3+
4+
Module for testing SOAP WSDL web services.
5+
Send requests and check if response matches the pattern.
6+
7+
This module can be used either with frameworks or PHPBrowser.
8+
It tries to guess the framework is is attached to.
9+
If a endpoint is a full url then it uses PHPBrowser.
10+
11+
### Using Inside Framework
12+
13+
Please note, that PHP SoapServer::handle method sends additional headers.
14+
This may trigger warning: "Cannot modify header information"
15+
If you use PHP SoapServer with framework, try to block call to this method in testing environment.
16+
17+
## Status
18+
19+
* Maintainer: **davert**
20+
* Stability: **stable**
21+
22+
23+
## Configuration
24+
25+
* endpoint *required* - soap wsdl endpoint
26+
* SOAPAction - replace SOAPAction HTTP header (Set to '' to SOAP 1.2)
27+
28+
## Public Properties
29+
30+
* xmlRequest - last SOAP request (DOMDocument)
31+
* xmlResponse - last SOAP response (DOMDocument)
32+
33+
34+
## Actions
35+
36+
### dontSeeSoapResponseContainsStructure
37+
38+
Opposite to `seeSoapResponseContainsStructure`
39+
* `param` $xml
40+
41+
42+
### dontSeeSoapResponseContainsXPath
43+
44+
Checks XML response doesn't contain XPath locator
45+
46+
``` php
47+
<?php
48+
$I->dontSeeSoapResponseContainsXPath('//root/user[@id=1]');
49+
?>
50+
```
51+
52+
* `param` $xpath
53+
54+
55+
### dontSeeSoapResponseEquals
56+
57+
Checks XML response equals provided XML.
58+
Comparison is done by canonicalizing both xml`s.
59+
60+
Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
61+
62+
* `param` $xml
63+
64+
65+
### dontSeeSoapResponseIncludes
66+
67+
Checks XML response does not include provided XML.
68+
Comparison is done by canonicalizing both xml`s.
69+
Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
70+
71+
* `param` $xml
72+
73+
74+
### grabAttributeFrom
75+
76+
Finds and returns attribute of element.
77+
Element is matched by either CSS or XPath
78+
79+
* `Available since` 1.1
80+
* `param` $cssOrXPath
81+
* `param` $attribute
82+
* `return` string
83+
84+
85+
### grabTextContentFrom
86+
87+
Finds and returns text contents of element.
88+
Element is matched by either CSS or XPath
89+
90+
* `Available since` 1.1
91+
* `param` $cssOrXPath
92+
* `return` string
93+
94+
95+
### haveSoapHeader
96+
97+
Prepare SOAP header.
98+
Receives header name and parameters as array.
99+
100+
Example:
101+
102+
``` php
103+
<?php
104+
$I->haveSoapHeader('AuthHeader', array('username' => 'davert', 'password' => '123345'));
105+
```
106+
107+
Will produce header:
108+
109+
```
110+
<soapenv:Header>
111+
<SessionHeader>
112+
<AuthHeader>
113+
<username>davert</username>
114+
<password>12345</password>
115+
</AuthHeader>
116+
</soapenv:Header>
117+
```
118+
119+
* `param` $header
120+
* `param array` $params
121+
122+
123+
### seeSoapResponseCodeIs
124+
125+
Checks response code from server.
126+
127+
* `param` $code
128+
129+
130+
### seeSoapResponseContainsStructure
131+
132+
Checks XML response contains provided structure.
133+
Response elements will be compared with XML provided.
134+
Only nodeNames are checked to see elements match.
135+
136+
Example:
137+
138+
``` php
139+
<?php
140+
141+
$I->seeSoapResponseContainsStructure("<query><name></name></query>");
142+
?>
143+
```
144+
145+
Use this method to check XML of valid structure is returned.
146+
This method does not use schema for validation.
147+
This method does not require path from root to match the structure.
148+
149+
* `param` $xml
150+
151+
152+
### seeSoapResponseContainsXPath
153+
154+
Checks XML response with XPath locator
155+
156+
``` php
157+
<?php
158+
$I->seeSoapResponseContainsXPath('//root/user[@id=1]');
159+
?>
160+
```
161+
162+
* `param` $xpath
163+
164+
165+
### seeSoapResponseEquals
166+
167+
Checks XML response equals provided XML.
168+
Comparison is done by canonicalizing both xml`s.
169+
170+
Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes).
171+
172+
Example:
173+
174+
``` php
175+
<?php
176+
$I->seeSoapResponseEquals("<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope><SOAP-ENV:Body><result>1</result></SOAP-ENV:Envelope>");
177+
178+
$dom = new \DOMDocument();
179+
$dom->load($file);
180+
$I->seeSoapRequestIncludes($dom);
181+
182+
```
183+
184+
* `param` $xml
185+
186+
187+
### seeSoapResponseIncludes
188+
189+
Checks XML response includes provided XML.
190+
Comparison is done by canonicalizing both xml`s.
191+
Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
192+
193+
Example:
194+
195+
``` php
196+
<?php
197+
$I->seeSoapResponseIncludes("<result>1</result>");
198+
$I->seeSoapRequestIncludes(\Codeception\Utils\Soap::response()->result->val(1));
199+
200+
$dom = new \DDOMDocument();
201+
$dom->load('template.xml');
202+
$I->seeSoapRequestIncludes($dom);
203+
?>
204+
```
205+
206+
* `param` $xml
207+
208+
209+
### sendSoapRequest
210+
211+
Submits request to endpoint.
212+
213+
Requires of api function name and parameters.
214+
Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes).
215+
216+
You are allowed to execute as much requests as you need inside test.
217+
218+
Example:
219+
220+
``` php
221+
$I->sendSoapRequest('UpdateUser', '<user><id>1</id><name>notdavert</name></user>');
222+
$I->sendSoapRequest('UpdateUser', \Codeception\Utils\Soap::request()->user
223+
->id->val(1)->parent()
224+
->name->val('notdavert');
225+
```
226+
227+
* `param` $request
228+
* `param` $body
229+
230+
<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/module-soap/tree/master/src/Codeception/Module/SOAP.php">Help us to improve documentation. Edit module reference</a></div>

readme.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Soap module for Codeception
2+
3+
[![Build Status](https://travis-ci.org/Codeception/module-soap.svg?branch=master)](https://travis-ci.org/Codeception/module-soap)
4+
5+
## Installation
6+
7+
```
8+
composer require --dev "codeception/module-soap"
9+
```
10+
11+
## Documentation
12+
13+
<a href="documentation.md">Look at documentation.md file</a>

tests/_data/layout.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.w3.org/2001/xml.xsd">
2+
<soapenv:Header/>
3+
<soapenv:Body/>
4+
</soapenv:Envelope>

0 commit comments

Comments
 (0)