| Conditions | 1 |
| Paths | 1 |
| Total Lines | 40 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types = 1); |
||
| 8 | public function testSend() |
||
| 9 | { |
||
| 10 | $requestData = 'fooData'; |
||
| 11 | $responseData = 'responseData'; |
||
| 12 | $location = 'https://pg.eet.cz'; |
||
| 13 | $soapAction = 'fooAction'; |
||
| 14 | |||
| 15 | $guzzleHttpClient = $this->createMock(\GuzzleHttp\Client::class); |
||
| 16 | $guzzleHttpClient |
||
| 17 | ->expects(self::once()) |
||
| 18 | ->method('send') |
||
| 19 | ->with(self::callback(function (\GuzzleHttp\Psr7\Request $request) use ($requestData, $location, $soapAction) { |
||
| 20 | $this->assertEquals([ |
||
| 21 | 'Host' => [ |
||
| 22 | 'pg.eet.cz', |
||
| 23 | ], |
||
| 24 | 'User-Agent' => [ |
||
| 25 | GuzzleSoapClientDriver::HEADER_USER_AGENT, |
||
| 26 | ], |
||
| 27 | 'Content-Type' => [ |
||
| 28 | 'text/xml; charset=utf-8', |
||
| 29 | ], |
||
| 30 | 'SOAPAction' => [ |
||
| 31 | $soapAction, |
||
| 32 | ], |
||
| 33 | 'Content-Length' => [ |
||
| 34 | strlen($requestData), |
||
| 35 | ], |
||
| 36 | ], $request->getHeaders()); |
||
| 37 | $this->assertEquals($location, (string) $request->getUri()); |
||
| 38 | |||
| 39 | return true; |
||
| 40 | })) |
||
| 41 | ->willReturn(new \GuzzleHttp\Psr7\Response(200, [], $responseData)); |
||
| 42 | |||
| 43 | $guzzleSoapClientDriver = new GuzzleSoapClientDriver($guzzleHttpClient); |
||
| 44 | $response = $guzzleSoapClientDriver->send($requestData, $location, $soapAction, SOAP_1_1); |
||
| 45 | |||
| 46 | $this->assertSame($responseData, $response); |
||
| 47 | } |
||
| 48 | |||
| 50 |