Skip to content

Commit a275ce2

Browse files
CodeDreddGregor Becker
and
Gregor Becker
authored
fix(laravel-soap-133): assertActionCalled did not work anymore with soap 1.2 (#136)
* fix(laravel-soap-133): Soap::assertActionCalled did not work anymore with soap 1.2 * Apply fixes from StyleCI (#137) Co-authored-by: Gregor Becker <[email protected]> Co-authored-by: Gregor Becker <[email protected]> Co-authored-by: Gregor Becker <[email protected]>
1 parent 2ad8c91 commit a275ce2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Client/Request.php

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use CodeDredd\Soap\Xml\SoapXml;
66
use CodeDredd\Soap\Xml\XMLSerializer;
77
use Illuminate\Support\Arr;
8+
use Illuminate\Support\Str;
89

910
/**
1011
* Class Request.
@@ -30,10 +31,17 @@ public function __construct($request)
3031
}
3132

3233
/**
34+
* Get the soap action for soap 1.1 and 1.2.
3335
* @return string
3436
*/
3537
public function action(): string
3638
{
39+
$contentType = $this->request->getHeaderLine('Content-Type');
40+
$soapAction = $this->request->getHeaderLine('SOAPAction');
41+
if (empty($soapAction)) {
42+
return Str::of($contentType)->afterLast('action=')->remove('"');
43+
}
44+
3745
return $this->request->getHeaderLine('SOAPAction');
3846
}
3947

tests/Unit/SoapClientTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public function testSoapOptions(): void
135135

136136
self::assertTrue($response->ok());
137137
self::assertStringContainsString('application/soap+xml; charset="utf-8', $lastRequestInfo->getLastRequestHeaders());
138+
Soap::assertActionCalled('Get_User');
138139
}
139140

140141
public function testRealSoapCall(): void

0 commit comments

Comments
 (0)