Add test for nested enum for php (#2989)
This commit is contained in:
parent
7be088202b
commit
b97cd573e4
@ -295,6 +295,12 @@ class GeneratedClassTest extends TestBase
|
||||
$this->assertEquals(TestEnum::ONE, $m->getOptionalEnum());
|
||||
}
|
||||
|
||||
public function testNestedEnum()
|
||||
{
|
||||
$m = new TestMessage();
|
||||
$m->setOptionalNestedEnum(\Foo\TestMessage_NestedEnum::ZERO);
|
||||
}
|
||||
|
||||
#########################################################
|
||||
# Test float field.
|
||||
#########################################################
|
||||
@ -835,6 +841,9 @@ class GeneratedClassTest extends TestBase
|
||||
$m = new TestMessage();
|
||||
$m->setOptionalNoNamespaceMessage(new NoNameSpaceMessage());
|
||||
$m->getRepeatedNoNamespaceMessage()[] = new NoNameSpaceMessage();
|
||||
|
||||
$n = new NoNamespaceMessage();
|
||||
$n->setB(NoNamespaceMessage_NestedEnum::ZERO);
|
||||
}
|
||||
|
||||
public function testEnumWithoutNamespace()
|
||||
|
@ -4,11 +4,13 @@
|
||||
|
||||
require_once('generated/NoNamespaceEnum.php');
|
||||
require_once('generated/NoNamespaceMessage.php');
|
||||
require_once('generated/NoNamespaceMessage_NestedEnum.php');
|
||||
require_once('generated/PrefixTestPrefix.php');
|
||||
require_once('generated/Bar/TestInclude.php');
|
||||
require_once('generated/Foo/TestEnum.php');
|
||||
require_once('generated/Foo/TestIncludePrefixMessage.php');
|
||||
require_once('generated/Foo/TestMessage.php');
|
||||
require_once('generated/Foo/TestMessage_NestedEnum.php');
|
||||
require_once('generated/Foo/TestMessage_Sub.php');
|
||||
require_once('generated/Foo/TestPackedMessage.php');
|
||||
require_once('generated/Foo/TestPhpDoc.php');
|
||||
|
@ -102,6 +102,12 @@ message TestMessage {
|
||||
NoNamespaceEnum optional_no_namespace_enum = 92;
|
||||
repeated NoNamespaceMessage repeated_no_namespace_message = 93;
|
||||
repeated NoNamespaceEnum repeated_no_namespace_enum = 94;
|
||||
|
||||
enum NestedEnum {
|
||||
ZERO = 0;
|
||||
}
|
||||
|
||||
NestedEnum optional_nested_enum = 101;
|
||||
}
|
||||
|
||||
enum TestEnum {
|
||||
|
@ -2,6 +2,11 @@ syntax = "proto3";
|
||||
|
||||
message NoNamespaceMessage {
|
||||
int32 a = 1;
|
||||
|
||||
enum NestedEnum {
|
||||
ZERO = 0;
|
||||
}
|
||||
NestedEnum b = 2;
|
||||
}
|
||||
|
||||
enum NoNamespaceEnum {
|
||||
|
Loading…
Reference in New Issue
Block a user