Completed
Push — master ( 511ed4...f38f4c )
by Piotr
04:05
created

shouldCreateBuilderWithClassNameWhenNameIsNotPass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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\Builder;
25
26
use PHPUnit_Framework_TestCase;
27
use WSDL\Annotation\BindingType;
28
use WSDL\Annotation\SoapBinding;
29
use WSDL\Builder\AnnotationWSDLBuilder;
30
31
/**
32
 * AnnotationWSDLBuilderTest
33
 *
34
 * @author Piotr Olaszewski <[email protected]>
35
 */
36
class AnnotationWSDLBuilderTest extends PHPUnit_Framework_TestCase
37
{
38
    /**
39
     * @test
40
     */
41
    public function shouldCreateBuilderForWebServiceAnnotation()
42
    {
43
        //given
44
        $annotationWSDLBuilder = new AnnotationWSDLBuilder('\Fixtures\WebServiceAllAnnotations');
45
46
        //when
47
        $annotationWSDLBuilder->build();
48
49
        //then
50
        $WSDLBuilder = $annotationWSDLBuilder->getBuilder();
51
        $this->assertEquals('WebServiceAnnotations', $WSDLBuilder->getName());
52
        $this->assertEquals('http://foo.bar/webserviceannotations', $WSDLBuilder->getTargetNamespace());
53
        $this->assertEquals('http://foo.bar/webserviceannotations/types', $WSDLBuilder->getNs());
54
        $this->assertEquals('http://localhost/wsdl-creator/service.php', $WSDLBuilder->getLocation());
55
    }
56
57
    /**
58
     * @test
59
     */
60
    public function shouldCreateBuilderForBindingTypeAnnotation()
61
    {
62
        //given
63
        $annotationWSDLBuilder = new AnnotationWSDLBuilder('\Fixtures\WebServiceAllAnnotations');
64
65
        //when
66
        $annotationWSDLBuilder->build();
67
68
        //then
69
        $WSDLBuilder = $annotationWSDLBuilder->getBuilder();
70
        $this->assertEquals(BindingType::SOAP_12, $WSDLBuilder->getSoapVersion());
71
    }
72
73
    /**
74
     * @test
75
     */
76
    public function shouldCreateBuilderForSoapBindingAnnotation()
77
    {
78
        //given
79
        $annotationWSDLBuilder = new AnnotationWSDLBuilder('\Fixtures\WebServiceAllAnnotations');
80
81
        //when
82
        $annotationWSDLBuilder->build();
83
84
        //then
85
        $WSDLBuilder = $annotationWSDLBuilder->getBuilder();
86
        $this->assertEquals(SoapBinding::DOCUMENT, $WSDLBuilder->getStyle());
87
        $this->assertEquals(SoapBinding::ENCODED, $WSDLBuilder->getUse());
88
        $this->assertEquals(SoapBinding::WRAPPED, $WSDLBuilder->getParameterStyle());
89
    }
90
91
    /**
92
     * @test
93
     */
94
    public function shouldCreateBuilderWithClassNameWhenNameIsNotPass()
95
    {
96
        //given
97
        $annotationWSDLBuilder = new AnnotationWSDLBuilder('\Fixtures\WebServiceClassAnnotations');
98
99
        //when
100
        $annotationWSDLBuilder->build();
101
102
        //then
103
        $WSDLBuilder = $annotationWSDLBuilder->getBuilder();
104
        $this->assertEquals('WebServiceClassAnnotations', $WSDLBuilder->getName());
105
    }
106
}
107