diff --git a/php/tests/generated_class_test.php b/php/tests/generated_class_test.php index 41d63a60d3..c5dee2d658 100644 --- a/php/tests/generated_class_test.php +++ b/php/tests/generated_class_test.php @@ -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() diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index 6b7077f06a..ea7a4c9613 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -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'); diff --git a/php/tests/proto/test.proto b/php/tests/proto/test.proto index cc9bf8c8db..b6c1486655 100644 --- a/php/tests/proto/test.proto +++ b/php/tests/proto/test.proto @@ -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 { diff --git a/php/tests/proto/test_no_namespace.proto b/php/tests/proto/test_no_namespace.proto index b0f6600255..3dd76764ff 100644 --- a/php/tests/proto/test_no_namespace.proto +++ b/php/tests/proto/test_no_namespace.proto @@ -2,6 +2,11 @@ syntax = "proto3"; message NoNamespaceMessage { int32 a = 1; + + enum NestedEnum { + ZERO = 0; + } + NestedEnum b = 2; } enum NoNamespaceEnum {