Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
b97cd573
Commit
b97cd573
authored
Apr 20, 2017
by
Paul Yang
Committed by
GitHub
Apr 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for nested enum for php (#2989)
parent
7be08820
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
0 deletions
+22
-0
generated_class_test.php
php/tests/generated_class_test.php
+9
-0
memory_leak_test.php
php/tests/memory_leak_test.php
+2
-0
test.proto
php/tests/proto/test.proto
+6
-0
test_no_namespace.proto
php/tests/proto/test_no_namespace.proto
+5
-0
No files found.
php/tests/generated_class_test.php
View file @
b97cd573
...
...
@@ -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
()
...
...
php/tests/memory_leak_test.php
View file @
b97cd573
...
...
@@ -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'
);
...
...
php/tests/proto/test.proto
View file @
b97cd573
...
...
@@ -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
{
...
...
php/tests/proto/test_no_namespace.proto
View file @
b97cd573
...
...
@@ -2,6 +2,11 @@ syntax = "proto3";
message
NoNamespaceMessage
{
int32
a
=
1
;
enum
NestedEnum
{
ZERO
=
0
;
}
NestedEnum
b
=
2
;
}
enum
NoNamespaceEnum
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment