Code Duplication    Length = 26-26 lines in 3 locations

tests/unit/SoapClientTest.php 3 locations

@@ 73-98 (lines=26) @@
70
    /**
71
     * @test
72
     */
73
    public function magicCall500Response()
74
    {
75
        $this->deferredHttpBinding = new FulfilledPromise($this->httpBindingMock);
76
77
        $this->httpBindingMock->method('request')
78
            ->willReturn(
79
                new Request('POST', 'www.endpoint.com')
80
            )
81
            ->with(
82
                'someSoapMethod', [['some-key' => 'some-value']]
83
            );
84
85
        $response = new Response('500');
86
        $this->httpBindingMock->method('response')
87
            ->willReturn(
88
                'SoapResult'
89
            )
90
            ->with(
91
                $response, 'someSoapMethod', null
92
            );
93
94
        $this->handlerMock->append(GuzzleRequestException::create(new Request('POST', 'www.endpoint.com'), $response));
95
96
        $client = new SoapClient($this->clientMock, $this->deferredHttpBinding);
97
        $this->assertEquals('SoapResult', $client->someSoapMethod(['some-key' => 'some-value'])->wait());
98
    }
99
100
    /**
101
     * @test
@@ 153-178 (lines=26) @@
150
     * @test
151
     * @expectedException \SoapFault
152
     */
153
    public function magicCallClientReturnSoapFault()
154
    {
155
        $this->deferredHttpBinding = new FulfilledPromise($this->httpBindingMock);
156
157
        $this->httpBindingMock->method('request')
158
            ->willReturn(
159
                new Request('POST', 'www.endpoint.com')
160
            )
161
            ->with(
162
                'someSoapMethod', [['some-key' => 'some-value']]
163
            );
164
165
        $response = new Response('200', [], 'body');
166
        $this->httpBindingMock->method('response')
167
            ->will(
168
                $this->throwException(new \SoapFault('soap fault', 'soap fault'))
169
            )
170
            ->with(
171
                $response, 'someSoapMethod', null
172
            );
173
174
        $this->handlerMock->append($response);
175
176
        $client = new SoapClient($this->clientMock, $this->deferredHttpBinding);
177
        $client->someSoapMethod(['some-key' => 'some-value'])->wait();
178
    }
179
180
    /**
181
     * @test
@@ 183-208 (lines=26) @@
180
    /**
181
     * @test
182
     */
183
    public function magicCallSuccess()
184
    {
185
        $this->deferredHttpBinding = new FulfilledPromise($this->httpBindingMock);
186
187
        $this->httpBindingMock->method('request')
188
            ->willReturn(
189
                new Request('POST', 'www.endpoint.com')
190
            )
191
            ->with(
192
                'someSoapMethod', [['some-key' => 'some-value']]
193
            );
194
195
        $response = new Response('200', [], 'body');
196
        $this->httpBindingMock->method('response')
197
            ->willReturn(
198
                'SoapResult'
199
            )
200
            ->with(
201
                $response, 'someSoapMethod', null
202
            );
203
204
        $this->handlerMock->append($response);
205
206
        $client = new SoapClient($this->clientMock, $this->deferredHttpBinding);
207
        $this->assertEquals('SoapResult', $client->someSoapMethod(['some-key' => 'some-value'])->wait());
208
    }
209
210
    /**
211
     * @test