1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (C) 2013-2016 |
4
|
|
|
* Piotr Olaszewski <[email protected]> |
5
|
|
|
* |
6
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
7
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
8
|
|
|
* in the Software without restriction, including without limitation the rights |
9
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
11
|
|
|
* furnished to do so, subject to the following conditions: |
12
|
|
|
* |
13
|
|
|
* The above copyright notice and this permission notice shall be included in |
14
|
|
|
* all copies or substantial portions of the Software. |
15
|
|
|
* |
16
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22
|
|
|
* SOFTWARE. |
23
|
|
|
*/ |
24
|
|
|
namespace Tests\WSDL\XML\XMLUse; |
25
|
|
|
|
26
|
|
|
use DOMDocument; |
27
|
|
|
use PHPUnit_Framework_TestCase; |
28
|
|
|
use WSDL\Annotation\BindingType; |
29
|
|
|
use WSDL\XML\XMLSoapVersion\XMLSoapVersion; |
30
|
|
|
use WSDL\XML\XMLUse\XMLUse; |
31
|
|
|
use WSDL\XML\XMLUse\XMLUseFactory; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* XMLBaseUseTest |
35
|
|
|
* |
36
|
|
|
* @author Piotr Olaszewski <[email protected]> |
37
|
|
|
*/ |
38
|
|
|
abstract class XMLBaseUseTest extends PHPUnit_Framework_TestCase |
39
|
|
|
{ |
40
|
|
|
/** |
41
|
|
|
* @var DOMDocument |
42
|
|
|
*/ |
43
|
|
|
protected $DOMDocument; |
44
|
|
|
/** |
45
|
|
|
* @var XMLUse |
46
|
|
|
*/ |
47
|
|
|
protected $XMLUse; |
48
|
|
|
protected $soapVersion; |
49
|
|
|
protected $targetNamespace = 'http://foo.bar/rpcliteralservice'; |
50
|
|
|
protected $soapHeaderMessage = 'tns:MethodRequestHeader'; |
51
|
|
|
|
52
|
|
|
public function setUp() |
53
|
|
|
{ |
54
|
|
|
parent::setUp(); |
55
|
|
|
$this->DOMDocument = new DOMDocument(); |
56
|
|
|
$this->XMLUse = XMLUseFactory::create($this->useType()); |
57
|
|
|
$this->soapVersion = XMLSoapVersion::getTagFor(BindingType::SOAP_11); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
abstract public function useType(); |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @test |
64
|
|
|
*/ |
65
|
|
|
public function shouldNotGenerateHeaderWhenIsNotNeeded() |
66
|
|
|
{ |
67
|
|
|
//when |
68
|
|
|
$soapHeaderIfNeeded = $this |
69
|
|
|
->XMLUse |
70
|
|
|
->generateSoapHeaderIfNeeded($this->DOMDocument, $this->targetNamespace, $this->soapHeaderMessage, null, $this->soapVersion); |
71
|
|
|
|
72
|
|
|
//then |
73
|
|
|
$this->assertNull($soapHeaderIfNeeded); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|