diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2016-11-21 12:01:51 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-21 12:01:51 -0800 |
commit | 2286e5f4d00c478d6f7f5abcd21c0e570feeb17c (patch) | |
tree | 4664c00f1f92e8b898d3977083b4a28e54a01b12 /php/tests | |
parent | 60d95f36c0081a03b947c2b625c10841bb19736c (diff) | |
download | protobuf-2286e5f4d00c478d6f7f5abcd21c0e570feeb17c.tar.gz protobuf-2286e5f4d00c478d6f7f5abcd21c0e570feeb17c.tar.bz2 protobuf-2286e5f4d00c478d6f7f5abcd21c0e570feeb17c.zip |
Rename Empty to GPBEmpty in php generated file. (#2379)
In php, class name cannot be "Empty". Modified code generator to (#2375) generate GPBEmpty instead (for google.protobuf.Empty only). Also change
runtime code to work with the new generated code accordingly.
Diffstat (limited to 'php/tests')
-rw-r--r-- | php/tests/google/protobuf/empty.pb.php | 28 | ||||
-rwxr-xr-x | php/tests/test.sh | 2 | ||||
-rw-r--r-- | php/tests/well_known_test.php | 13 |
3 files changed, 42 insertions, 1 deletions
diff --git a/php/tests/google/protobuf/empty.pb.php b/php/tests/google/protobuf/empty.pb.php new file mode 100644 index 00000000..fdd0fe4f --- /dev/null +++ b/php/tests/google/protobuf/empty.pb.php @@ -0,0 +1,28 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/protobuf/empty.proto + +namespace Google\Protobuf; + +use Google\Protobuf\Internal\DescriptorPool; +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\GPBUtil; + +class GPBEmpty extends \Google\Protobuf\Internal\Message +{ + +} + +$pool = DescriptorPool::getGeneratedPool(); + +$pool->internalAddGeneratedFile(hex2bin( + "0ab7010a1b676f6f676c652f70726f746f6275662f656d7074792e70726f" . + "746f120f676f6f676c652e70726f746f62756622070a05456d7074794276" . + "0a13636f6d2e676f6f676c652e70726f746f627566420a456d7074795072" . + "6f746f50015a276769746875622e636f6d2f676f6c616e672f70726f746f" . + "6275662f7074797065732f656d707479f80101a20203475042aa021e476f" . + "6f676c652e50726f746f6275662e57656c6c4b6e6f776e54797065736206" . + "70726f746f33" +)); + diff --git a/php/tests/test.sh b/php/tests/test.sh index 888e93eb..ba0666b3 100755 --- a/php/tests/test.sh +++ b/php/tests/test.sh @@ -10,7 +10,7 @@ set -e phpize && ./configure --enable-debug CFLAGS='-g -O0' && make popd -tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php ) +tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php ) for t in "${tests[@]}" do diff --git a/php/tests/well_known_test.php b/php/tests/well_known_test.php new file mode 100644 index 00000000..30715ba9 --- /dev/null +++ b/php/tests/well_known_test.php @@ -0,0 +1,13 @@ +<?php + +require_once("google/protobuf/empty.pb.php"); + +use Google\Protobuf\GPBEmpty; + +class WellKnownTest extends PHPUnit_Framework_TestCase { + + public function testNone() { + $msg = new GPBEmpty(); + } + +} |