diff --git a/src/AbstractSoapClientBase.php b/src/AbstractSoapClientBase.php index e9aa85f..accac03 100644 --- a/src/AbstractSoapClientBase.php +++ b/src/AbstractSoapClientBase.php @@ -100,7 +100,7 @@ protected static function canInstantiateSoapClientWithOptions(array $wsdlOptions */ public function getSoapClientClassName(?string $soapClientClassName = null): string { - $className = self::DEFAULT_SOAP_CLIENT_CLASS; + $className = static::DEFAULT_SOAP_CLIENT_CLASS; if (!empty($soapClientClassName) && is_subclass_of($soapClientClassName, SoapClient::class)) { $className = $soapClientClassName; } diff --git a/tests/CustomSoapClientService.php b/tests/CustomSoapClientService.php new file mode 100644 index 0000000..7438fdd --- /dev/null +++ b/tests/CustomSoapClientService.php @@ -0,0 +1,26 @@ +assertSame(Client::class, $soapClient->getSoapClientClassName(Client::class)); } + public function testCustomSoapClientNameReadFromConstant() + { + $defaultService = new DefaultSoapClientService(); + $customService = new CustomSoapClientService(); + + $this->assertSame(SoapClientBase::class, $defaultService->getSoapClientClassName()); + $this->assertSame(Client::class, $customService->getSoapClientClassName()); + } + public function testSoapClient(): void { $soapClient = new SoapClient([ @@ -489,4 +498,5 @@ public function testGetOutputHeadersWithoutRequestMustReturnAnEmptyArray(): void $this->assertTrue(is_array($soapClient->getOutputHeaders())); $this->assertEmpty($soapClient->getOutputHeaders()); } + }