Skip to content

Commit f707675

Browse files
authored
Merge pull request #3217 from wing328/php_enum_class
[PHP] add enum class support, merge test cases
2 parents 81339ad + 74239c4 commit f707675

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3505
-612
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class CodegenProperty implements Cloneable {
4545
public Map<String, Object> vendorExtensions;
4646
public Boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
4747
public Boolean isInherited;
48+
public String nameInCamelCase; // property name in camel case
4849

4950
@Override
5051
public String toString() {
@@ -108,6 +109,7 @@ public int hashCode()
108109
result = prime * result + ((isMapContainer == null) ? 0 : isMapContainer.hashCode());
109110
result = prime * result + ((isListContainer == null) ? 0 : isListContainer.hashCode());
110111
result = prime * result + Objects.hashCode(isInherited);
112+
result = prime * result + Objects.hashCode(nameInCamelCase);
111113
return result;
112114
}
113115

@@ -262,6 +264,9 @@ public boolean equals(Object obj) {
262264
if (!Objects.equals(this.isInherited, other.isInherited)) {
263265
return false;
264266
}
267+
if (!Objects.equals(this.nameInCamelCase, other.nameInCamelCase)) {
268+
return false;
269+
}
265270
return true;
266271
}
267272

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,7 @@ public CodegenProperty fromProperty(String name, Property p) {
12961296

12971297
property.name = toVarName(name);
12981298
property.baseName = name;
1299+
property.nameInCamelCase = camelize(name, false);
12991300
property.description = escapeText(p.getDescription());
13001301
property.unescapedDescription = p.getDescription();
13011302
property.getter = "get" + getterAndSetterCapitalize(name);

modules/swagger-codegen/src/main/resources/php/api_test.mustache

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* Please update the test case below to test the endpoint.
1818
*/
1919

20-
namespace {{apiPackage}};
20+
namespace {{invokerPackage}};
2121

2222
use \{{invokerPackage}}\Configuration;
2323
use \{{invokerPackage}}\ApiClient;
@@ -37,16 +37,32 @@ use \{{invokerPackage}}\ObjectSerializer;
3737
{
3838
3939
/**
40-
* Setup before running each test case
40+
* Setup before running any test cases
4141
*/
4242
public static function setUpBeforeClass()
4343
{
4444
4545
}
4646

47+
/**
48+
* Setup before running each test case
49+
*/
50+
public function setUp()
51+
{
52+
53+
}
54+
4755
/**
4856
* Clean up after running each test case
4957
*/
58+
public function tearDown()
59+
{
60+
61+
}
62+
63+
/**
64+
* Clean up after running all test cases
65+
*/
5066
public static function tearDownAfterClass()
5167
{
5268
@@ -63,6 +79,7 @@ use \{{invokerPackage}}\ObjectSerializer;
6379
{
6480
6581
}
82+
6683
{{/operation}}
6784
}
6885
{{/operations}}

0 commit comments

Comments
 (0)