aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/tests
diff options
context:
space:
mode:
authorGravatar Paul Yang <TeBoring@users.noreply.github.com>2016-11-10 11:20:50 -0800
committerGravatar GitHub <noreply@github.com>2016-11-10 11:20:50 -0800
commitdf8390790aae6025e95687a37eea81a4757966d0 (patch)
treec2659eb553f560bed02b984050462cba961aaf46 /php/tests
parent9f75c5aa851cd877fb0d93ccc31b8567a6706546 (diff)
Fix php c extension on 32-bit machines. (#2348)
Diffstat (limited to 'php/tests')
-rwxr-xr-xphp/tests/test.sh3
-rw-r--r--php/tests/test_base.php18
2 files changed, 15 insertions, 6 deletions
diff --git a/php/tests/test.sh b/php/tests/test.sh
index 888e93eb..fe3dc7f6 100755
--- a/php/tests/test.sh
+++ b/php/tests/test.sh
@@ -7,7 +7,8 @@
pushd ../ext/google/protobuf/
make clean
set -e
-phpize && ./configure --enable-debug CFLAGS='-g -O0' && make
+# Add following in configure for debug: --enable-debug CFLAGS='-g -O0'
+phpize && ./configure && make
popd
tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php )
diff --git a/php/tests/test_base.php b/php/tests/test_base.php
index 49886050..d461f0f7 100644
--- a/php/tests/test_base.php
+++ b/php/tests/test_base.php
@@ -75,20 +75,28 @@ class TestBase extends PHPUnit_Framework_TestCase
{
$this->assertSame(0, $m->getOptionalInt32());
$this->assertSame(0, $m->getOptionalUint32());
- $this->assertSame(0, $m->getOptionalInt64());
- $this->assertSame(0, $m->getOptionalUint64());
$this->assertSame(0, $m->getOptionalSint32());
- $this->assertSame(0, $m->getOptionalSint64());
$this->assertSame(0, $m->getOptionalFixed32());
- $this->assertSame(0, $m->getOptionalFixed64());
$this->assertSame(0, $m->getOptionalSfixed32());
- $this->assertSame(0, $m->getOptionalSfixed64());
$this->assertSame(0.0, $m->getOptionalFloat());
$this->assertSame(0.0, $m->getOptionalDouble());
$this->assertSame(false, $m->getOptionalBool());
$this->assertSame('', $m->getOptionalString());
$this->assertSame('', $m->getOptionalBytes());
$this->assertNull($m->getOptionalMessage());
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame("0", $m->getOptionalInt64());
+ $this->assertSame("0", $m->getOptionalUint64());
+ $this->assertSame("0", $m->getOptionalSint64());
+ $this->assertSame("0", $m->getOptionalFixed64());
+ $this->assertSame("0", $m->getOptionalSfixed64());
+ } else {
+ $this->assertSame(0, $m->getOptionalInt64());
+ $this->assertSame(0, $m->getOptionalUint64());
+ $this->assertSame(0, $m->getOptionalSint64());
+ $this->assertSame(0, $m->getOptionalFixed64());
+ $this->assertSame(0, $m->getOptionalSfixed64());
+ }
}
// This test is to avoid the warning of no test by php unit.