aboutsummaryrefslogtreecommitdiff
path: root/php/tests/test_base.php
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2016-11-10 11:20:50 -0800
committerGitHub <noreply@github.com>2016-11-10 11:20:50 -0800
commitdf8390790aae6025e95687a37eea81a4757966d0 (patch)
treec2659eb553f560bed02b984050462cba961aaf46 /php/tests/test_base.php
parent9f75c5aa851cd877fb0d93ccc31b8567a6706546 (diff)
downloadprotobuf-df8390790aae6025e95687a37eea81a4757966d0.tar.gz
protobuf-df8390790aae6025e95687a37eea81a4757966d0.tar.bz2
protobuf-df8390790aae6025e95687a37eea81a4757966d0.zip
Fix php c extension on 32-bit machines. (#2348)
Diffstat (limited to 'php/tests/test_base.php')
-rw-r--r--php/tests/test_base.php18
1 files changed, 13 insertions, 5 deletions
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.