From ecca6ea95d56a6f70ff7b223ec3f904758acc8b1 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Fri, 30 Jun 2017 12:14:09 -0700 Subject: Add json encode/decode for php. (#3226) * Add json encode/decode for php. * Fix php conformance test on 32-bit machines. * Fix conformance test for c extension. * Fix comments --- php/tests/compatibility_test.sh | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'php/tests/compatibility_test.sh') diff --git a/php/tests/compatibility_test.sh b/php/tests/compatibility_test.sh index e05b2af1..6f1e4900 100755 --- a/php/tests/compatibility_test.sh +++ b/php/tests/compatibility_test.sh @@ -1,6 +1,6 @@ #!/bin/bash -use_php() { +function use_php() { VERSION=$1 PHP=`which php` PHP_CONFIG=`which php-config` @@ -10,7 +10,7 @@ use_php() { ln -sfn "/usr/local/php-${VERSION}/bin/phpize" $PHPIZE } -generate_proto() { +function generate_proto() { PROTOC1=$1 PROTOC2=$2 @@ -25,6 +25,27 @@ generate_proto() { popd } +# Remove tests to expect error. These were added to API tests by mistake. +function remove_error_test() { + local TEMPFILE=`tempfile` + cat $1 | \ + awk -v file=`basename $1` -v dir=`basename $(dirname $1)` ' + BEGIN { + show = 1 + } + /@expectedException PHPUnit_Framework_Error/ { show = 0; next; } + / *\*\// { print; next; } + / *}/ { + if (!show) { + show = 1; + next; + } + } + show { print } + ' > $TEMPFILE + cp $TEMPFILE $1 +} + set -ex # Change to the script's directory. @@ -81,6 +102,15 @@ OLD_PROTOC=`pwd`/old_protoc cd protobuf/php cp -r /usr/local/vendor-5.5 vendor wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit + +# Remove implementation detail tests. +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 +for t in "${tests[@]}" +do + remove_error_test tests/$t +done + cd tests # Test A.1: -- cgit v1.2.3