Fix php tests

pull/4908/head
Bo Yang 6 years ago
parent f21d4d6830
commit 51c188c2cc
  1. 1
      php/ext/google/protobuf/message.c
  2. 7
      php/src/Google/Protobuf/Internal/GPBUtil.php
  3. 2
      php/tests/compatibility_test.sh
  4. 1
      php/tests/test_util.php

@ -283,6 +283,7 @@ void build_class_from_descriptor(
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Message_construct(zval* msg, zval* array_wrapper) { void Message_construct(zval* msg, zval* array_wrapper) {
TSRMLS_FETCH();
zend_class_entry* ce = Z_OBJCE_P(msg); zend_class_entry* ce = Z_OBJCE_P(msg);
MessageHeader* intern = NULL; MessageHeader* intern = NULL;
if (EXPECTED(class_added(ce))) { if (EXPECTED(class_added(ce))) {

@ -305,11 +305,8 @@ class GPBUtil
$name, $name,
$file_proto) $file_proto)
{ {
$parts = explode('.', $name); $classname = implode('_', explode('.', $name));
foreach ($parts as $i => $part) { return static::getClassNamePrefix($classname, $file_proto) . $classname;
$parts[$i] = static::getClassNamePrefix($parts[$i], $file_proto) . $parts[$i];
}
return implode('\\', $parts);
} }
public static function getClassNameWithoutPackage( public static function getClassNameWithoutPackage(

@ -122,6 +122,8 @@ composer install
tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php ) tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php )
sed -i.bak '/php_implementation_test.php/d' phpunit.xml sed -i.bak '/php_implementation_test.php/d' phpunit.xml
sed -i.bak '/generated_phpdoc_test.php/d' phpunit.xml sed -i.bak '/generated_phpdoc_test.php/d' phpunit.xml
sed -i.bak 's/generated_phpdoc_test.php//g' tests/test.sh
sed -i.bak '/memory_leak_test.php/d' tests/test.sh
for t in "${tests[@]}" for t in "${tests[@]}"
do do
remove_error_test tests/$t remove_error_test tests/$t

@ -241,6 +241,7 @@ class TestUtil
if (PHP_INT_SIZE == 4) { if (PHP_INT_SIZE == 4) {
assert('-43' === $m->getRepeatedInt64()[0]); assert('-43' === $m->getRepeatedInt64()[0]);
assert('43' === $m->getRepeatedUint64()[0]); assert('43' === $m->getRepeatedUint64()[0]);
var_dump($m->getRepeatedSint64()[0]);
assert('-45' === $m->getRepeatedSint64()[0]); assert('-45' === $m->getRepeatedSint64()[0]);
assert('47' === $m->getRepeatedFixed64()[0]); assert('47' === $m->getRepeatedFixed64()[0]);
assert('-47' === $m->getRepeatedSfixed64()[0]); assert('-47' === $m->getRepeatedSfixed64()[0]);

Loading…
Cancel
Save