| @@ 94-119 (lines=26) @@ | ||
| 91 | * @test |
|
| 92 | * @expectedException \SoapFault |
|
| 93 | */ |
|
| 94 | public function magicCallClientReturnSoapFault() |
|
| 95 | { |
|
| 96 | $this->deferredHttpBinding = new FulfilledPromise($this->httpBindingMock); |
|
| 97 | ||
| 98 | $this->httpBindingMock->method('request') |
|
| 99 | ->willReturn( |
|
| 100 | new Request('POST', 'www.endpoint.com') |
|
| 101 | ) |
|
| 102 | ->with( |
|
| 103 | 'someSoapMethod', [['some-key' => 'some-value']] |
|
| 104 | ); |
|
| 105 | ||
| 106 | $response = new Response('200', [], 'body'); |
|
| 107 | $this->httpBindingMock->method('response') |
|
| 108 | ->will( |
|
| 109 | $this->throwException(new \SoapFault('soap fault', 'soap fault')) |
|
| 110 | ) |
|
| 111 | ->with( |
|
| 112 | $response, 'someSoapMethod', null |
|
| 113 | ); |
|
| 114 | ||
| 115 | $this->handlerMock->append($response); |
|
| 116 | ||
| 117 | $client = new SoapClient($this->clientMock, $this->deferredHttpBinding); |
|
| 118 | $client->someSoapMethod(['some-key' => 'some-value'])->wait(); |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * @test |
|
| @@ 124-149 (lines=26) @@ | ||
| 121 | /** |
|
| 122 | * @test |
|
| 123 | */ |
|
| 124 | public function magicCallSuccess() |
|
| 125 | { |
|
| 126 | $this->deferredHttpBinding = new FulfilledPromise($this->httpBindingMock); |
|
| 127 | ||
| 128 | $this->httpBindingMock->method('request') |
|
| 129 | ->willReturn( |
|
| 130 | new Request('POST', 'www.endpoint.com') |
|
| 131 | ) |
|
| 132 | ->with( |
|
| 133 | 'someSoapMethod', [['some-key' => 'some-value']] |
|
| 134 | ); |
|
| 135 | ||
| 136 | $response = new Response('200', [], 'body'); |
|
| 137 | $this->httpBindingMock->method('response') |
|
| 138 | ->willReturn( |
|
| 139 | 'SoapResult' |
|
| 140 | ) |
|
| 141 | ->with( |
|
| 142 | $response, 'someSoapMethod', null |
|
| 143 | ); |
|
| 144 | ||
| 145 | $this->handlerMock->append($response); |
|
| 146 | ||
| 147 | $client = new SoapClient($this->clientMock, $this->deferredHttpBinding); |
|
| 148 | $this->assertEquals('SoapResult', $client->someSoapMethod(['some-key' => 'some-value'])->wait()); |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * @test |
|