From b2685f875f5abb47f80e62a5f11867a9d259d066 Mon Sep 17 00:00:00 2001 From: Christo Yovev <78204876+chyovev@users.noreply.github.com> Date: Mon, 5 Feb 2024 23:00:25 +0100 Subject: [PATCH 1/4] Fix specifying a custom SoapClient for a service by overriding the default constant value (#51) --- src/AbstractSoapClientBase.php | 2 +- tests/CustomSoapClientService.php | 26 ++++++++++++++++++++++++++ tests/DefaultSoapClientService.php | 17 +++++++++++++++++ tests/SoapClientTest.php | 10 ++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/CustomSoapClientService.php create mode 100644 tests/DefaultSoapClientService.php 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()); } + } From de01c9723d028565e1a1be7e6c968934389deb3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20DELSOL?= Date: Mon, 5 Feb 2024 23:01:01 +0100 Subject: [PATCH 2/4] Update contributors list, used github token for Sonars workflow --- .github/workflows/sonars.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonars.yml b/.github/workflows/sonars.yml index 63dca08..b8f9453 100644 --- a/.github/workflows/sonars.yml +++ b/.github/workflows/sonars.yml @@ -33,7 +33,7 @@ jobs: - name: Monitor coverage uses: slavcodev/coverage-monitor-action@v1 with: - github_token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} coverage_path: coverage.xml threshold_alert: 95 threshold_warning: 90 @@ -44,5 +44,5 @@ jobs: - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: - GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 227a4e3add5b52cd41e0c2409cf2da3540f04129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20DELSOL?= Date: Mon, 5 Feb 2024 23:01:01 +0100 Subject: [PATCH 3/4] Update contributors list, used github token for Sonars workflow --- composer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/composer.json b/composer.json index 0e145a9..9d3d058 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,10 @@ { "name": "maurobn", "role": "Contributor" + }, + { + "name": "Christo Yovev", + "role": "Contributor" } ], "support" : { From 3816218cff79d01765012bcbce874d72b4b9c0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20DELSOL?= Date: Mon, 5 Feb 2024 23:04:19 +0100 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84e94b0..084e347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## 5.0.4 - 2024/02/05 +- PR #51 - Fix overriding the custom SoapClient class + ## 5.0.3 - 2023/02/09 - PR #38 - type checking exception raised in php8