File tree Expand file tree Collapse file tree 7 files changed +63
-3
lines changed Expand file tree Collapse file tree 7 files changed +63
-3
lines changed Original file line number Diff line number Diff line change 3333 - name : Monitor coverage
3434 uses : slavcodev/coverage-monitor-action@v1
3535 with :
36- github_token : ${{ secrets.ACTIONS_GITHUB_TOKEN }}
36+ github_token : ${{ secrets.GITHUB_TOKEN }}
3737 coverage_path : coverage.xml
3838 threshold_alert : 95
3939 threshold_warning : 90
4444 - name : SonarCloud Scan
4545 uses : SonarSource/sonarcloud-github-action@master
4646 env :
47- GITHUB_TOKEN : ${{ secrets.ACTIONS_GITHUB_TOKEN }}
47+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4848 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## 5.0.4 - 2024/02/05
4+ - PR #51 - Fix overriding the custom SoapClient class
5+
36## 5.0.3 - 2023/02/09
47- PR #38 - type checking exception raised in php8
58
Original file line number Diff line number Diff line change 4848 {
4949 "name" : " maurobn" ,
5050 "role" : " Contributor"
51+ },
52+ {
53+ "name" : " Christo Yovev" ,
54+ "role" : " Contributor"
5155 }
5256 ],
5357 "support" : {
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ protected static function canInstantiateSoapClientWithOptions(array $wsdlOptions
100100 */
101101 public function getSoapClientClassName (?string $ soapClientClassName = null ): string
102102 {
103- $ className = self ::DEFAULT_SOAP_CLIENT_CLASS ;
103+ $ className = static ::DEFAULT_SOAP_CLIENT_CLASS ;
104104 if (!empty ($ soapClientClassName ) && is_subclass_of ($ soapClientClassName , SoapClient::class)) {
105105 $ className = $ soapClientClassName ;
106106 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace WsdlToPhp \PackageBase \Tests ;
6+
7+ use WsdlToPhp \PackageBase \AbstractSoapClientBase ;
8+
9+ /**
10+ * Services can specify a custom SoapClient class
11+ * to be used instead of PHP default by overriding
12+ * the constant below.
13+ *
14+ * @see \WsdlToPhp\PackageBase\SoapClientInterface
15+ * @see \WsdlToPhp\PackageBase\AbstractSoapClientBase :: getSoapClientClassName()
16+ */
17+
18+ class CustomSoapClientService extends AbstractSoapClientBase
19+ {
20+
21+ /**
22+ * Custom SoapClient class used for current service.
23+ */
24+ const DEFAULT_SOAP_CLIENT_CLASS = Client::class;
25+
26+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace WsdlToPhp \PackageBase \Tests ;
6+
7+ use WsdlToPhp \PackageBase \AbstractSoapClientBase ;
8+
9+ /**
10+ * By default all services extending the packagebase's
11+ * abstract class rely on PHP's default SoapClient.
12+ */
13+
14+ class DefaultSoapClientService extends AbstractSoapClientBase
15+ {
16+
17+ }
Original file line number Diff line number Diff line change @@ -25,6 +25,15 @@ public function testSoapClientNameDefault(): void
2525 $ this ->assertSame (Client::class, $ soapClient ->getSoapClientClassName (Client::class));
2626 }
2727
28+ public function testCustomSoapClientNameReadFromConstant ()
29+ {
30+ $ defaultService = new DefaultSoapClientService ();
31+ $ customService = new CustomSoapClientService ();
32+
33+ $ this ->assertSame (SoapClientBase::class, $ defaultService ->getSoapClientClassName ());
34+ $ this ->assertSame (Client::class, $ customService ->getSoapClientClassName ());
35+ }
36+
2837 public function testSoapClient (): void
2938 {
3039 $ soapClient = new SoapClient ([
@@ -489,4 +498,5 @@ public function testGetOutputHeadersWithoutRequestMustReturnAnEmptyArray(): void
489498 $ this ->assertTrue (is_array ($ soapClient ->getOutputHeaders ()));
490499 $ this ->assertEmpty ($ soapClient ->getOutputHeaders ());
491500 }
501+
492502}
You can’t perform that action at this time.
0 commit comments