Skip to content

Commit 1362bf6

Browse files
authored
fix: Arguments are parsed from body instead of xmlContent (#205)
* Arguments are parsed from body instead of xmlContent * Add test for Request::argument
1 parent 13a257d commit 1362bf6

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Client/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function xmlContent(): string
155155
*/
156156
public function arguments(): array
157157
{
158-
$doc = Document::fromXmlString($this->xmlContent());
158+
$doc = Document::fromXmlString($this->body());
159159
$method = $doc->locate(new SoapBodyLocator())?->firstElementChild;
160160

161161
return Arr::wrap(Arr::get(element_decode($method, traverse(new RemoveNamespaces())), 'node', []));

tests/Unit/SoapClientTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,19 @@ public function testSoapWithDifferentHeaders($header, $exspected): void
254254
Soap::assertActionCalled('GetWeatherInformation');
255255
}
256256

257+
public function testArgumentsCanBeCalledTwice(): void
258+
{
259+
Soap::fake();
260+
Event::fake();
261+
Soap::assertNothingSent();
262+
$response = Soap::baseWsdl(dirname(__DIR__, 1).'/Fixtures/Wsdl/weather.wsdl')
263+
->call('GetWeatherInformation');
264+
self::assertTrue($response->ok());
265+
Soap::assertSent(function (Request $request) {
266+
return $request->arguments() === $request->arguments();
267+
});
268+
}
269+
257270
public function soapHeaderProvider(): array
258271
{
259272
$header = [

0 commit comments

Comments
 (0)