File tree Expand file tree Collapse file tree 6 files changed +64
-1
lines changed Expand file tree Collapse file tree 6 files changed +64
-1
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ jobs:
173173 ;;
174174 php)
175175 composer install
176+ find . -name "*.php" ! -path "./vendor/*" -exec php -l {} +
176177 ;;
177178 python)
178179 pip install -e .
Original file line number Diff line number Diff line change @@ -172,6 +172,11 @@ public function getFiles(): array
172172 'destination ' => 'composer.json ' ,
173173 'template ' => 'php/composer.json.twig ' ,
174174 ],
175+ [
176+ 'scope ' => 'default ' ,
177+ 'destination ' => 'phpunit.xml ' ,
178+ 'template ' => 'php/phpunit.xml.twig ' ,
179+ ],
175180 [
176181 'scope ' => 'service ' ,
177182 'destination ' => 'docs/{{service.name | caseLower}}.md ' ,
Original file line number Diff line number Diff line change 77 "url": "{{ spec .contactURL }}",
88 "email": "{{ spec .contactEmail }}"
99 },
10+ "scripts": {
11+ "test": "vendor/bin/phpunit"
12+ },
1013 "autoload": {
1114 "psr-4": {
1215 "{{spec .title | caseUcfirst }}\\": "src/{{spec .title | caseUcfirst }}"
1922 },
2023 "require-dev": {
2124 "phpunit/phpunit": "^10",
22- "mockery/mockery": "^1.6.6 "
25+ "mockery/mockery": "^1.6.12 "
2326 },
2427 "minimum-stability": "dev"
2528}
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <phpunit
3+ xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi:noNamespaceSchemaLocation =" https://schema.phpunit.de/10.5/phpunit.xsd"
5+ bootstrap =" vendor/autoload.php"
6+ cacheDirectory =" .phpunit.cache"
7+ colors =" true"
8+ displayDetailsOnIncompleteTests =" true"
9+ displayDetailsOnSkippedTests =" true"
10+ displayDetailsOnTestsThatTriggerDeprecations =" true"
11+ displayDetailsOnTestsThatTriggerErrors =" true"
12+ displayDetailsOnTestsThatTriggerNotices =" true"
13+ displayDetailsOnTestsThatTriggerWarnings =" true"
14+ failOnDeprecation =" true"
15+ failOnEmptyTestSuite =" true"
16+ failOnIncomplete =" true"
17+ failOnRisky =" true"
18+ failOnSkipped =" true"
19+ failOnWarning =" true"
20+ >
21+ <testsuites >
22+ <testsuite name =" {{ spec .title | caseUcfirst }} SDK Test Suite" >
23+ <directory >./tests/</directory >
24+ </testsuite >
25+ </testsuites >
26+
27+ <source >
28+ <include >
29+ <directory suffix =" .php" >./src/{{ spec .title | caseUcfirst }}</directory >
30+ </include >
31+ </source >
32+ </phpunit >
Original file line number Diff line number Diff line change @@ -30,7 +30,17 @@ class {{ service.name | caseUcfirst }} extends Service
3030 parent :: __construct($client );
3131 }
3232
33+ {% set nonDeprecatedMethodNames = [] % }
3334{% for method in service . methods % }
35+ {% if not method . deprecated % }
36+ {% set nonDeprecatedMethodNames = nonDeprecatedMethodNames | merge([method . name | caseCamel | lower ]) % }
37+ {% endif % }
38+ {% endfor % }
39+ {% for method in service . methods % }
40+ {% set methodNameLower = method . name | caseCamel | lower % }
41+ {% if method . deprecated and methodNameLower in nonDeprecatedMethodNames % }
42+ {# Skip deprecated methods that have namespace collisions with non-deprecated methods #}
43+ {% else % }
3444{% set deprecated_message = ' ' % }
3545 /**
3646{% if method.description %}
@@ -72,6 +82,7 @@ class {{ service.name | caseUcfirst }} extends Service
7282 }
7383 {% ~ if not loop . last % }
7484
85+ {% ~ endif % }
7586 {% ~ endif % }
7687 {% ~ endfor % }
7788}
Original file line number Diff line number Diff line change @@ -16,7 +16,17 @@ final class {{service.name | caseUcfirst}}Test extends TestCase {
1616 $this -> {{ service . name | caseCamel }} = new {{ service . name | caseUcfirst }}($this -> client );
1717 }
1818
19+ {% set nonDeprecatedMethodNames = [] % }
1920{% for method in service . methods % }
21+ {% if not method . deprecated % }
22+ {% set nonDeprecatedMethodNames = nonDeprecatedMethodNames | merge([method . name | caseCamel | lower ]) % }
23+ {% endif % }
24+ {% endfor % }
25+ {% for method in service . methods % }
26+ {% set methodNameLower = method . name | caseCamel | lower % }
27+ {% if method . deprecated and methodNameLower in nonDeprecatedMethodNames % }
28+ {# Skip deprecated methods that have namespace collisions with non-deprecated methods #}
29+ {% else % }
2030 public function testMethod {{method . name | caseUcfirst }}(): void {
2131 {% ~ if method . responseModel and method . responseModel ! = ' any' ~ % }
2232 $data = array (
@@ -40,5 +50,6 @@ final class {{service.name | caseUcfirst}}Test extends TestCase {
4050 $this -> assertSame($data , $response );
4151 }
4252
53+ {% endif % }
4354{% endfor % }
4455}
You can’t perform that action at this time.
0 commit comments