This repository has been archived by the owner on Jan 12, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a62bfa
commit 3ab9e6a
Showing
13 changed files
with
364 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--TEST-- | ||
Protocol Buffers appending floating-point value | ||
--SKIPIF-- | ||
<?php require 'skipif.inc' ?> | ||
--FILE-- | ||
<?php | ||
require 'Foo.php'; | ||
|
||
$foo = new Foo(); | ||
|
||
/* from float type */ | ||
$foo->appendFloatPackedField(2.0); | ||
|
||
/* from int type */ | ||
$intValue = 3; | ||
$foo->appendFloatPackedField($intValue); | ||
var_dump($intValue); | ||
|
||
/* from string type */ | ||
$stringValue = '4'; | ||
$foo->appendFloatPackedField($stringValue); | ||
var_dump($stringValue); | ||
|
||
/* from null */ | ||
$nullValue = null; | ||
$foo->appendFloatPackedField($nullValue); | ||
|
||
$values = $foo->getFloatPackedField(); | ||
var_dump(count($values)); | ||
var_dump($values[0]); | ||
var_dump($values[1]); | ||
var_dump($values[2]); | ||
?> | ||
--EXPECT-- | ||
int(3) | ||
string(1) "4" | ||
int(3) | ||
float(2) | ||
float(3) | ||
float(4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--TEST-- | ||
Protocol Buffers appending integer value | ||
--SKIPIF-- | ||
<?php require 'skipif.inc' ?> | ||
--FILE-- | ||
<?php | ||
require 'Foo.php'; | ||
|
||
$foo = new Foo(); | ||
|
||
/* from int type */ | ||
$foo->appendInt32PackedField(2); | ||
|
||
/* from float type */ | ||
$floatValue = 3.0; | ||
$foo->appendInt32PackedField($floatValue); | ||
var_dump($floatValue); | ||
|
||
/* from string type */ | ||
$stringValue = '4'; | ||
$foo->appendInt32PackedField($stringValue); | ||
var_dump($stringValue); | ||
|
||
/* from null */ | ||
$nullValue = null; | ||
$foo->appendInt32PackedField($nullValue); | ||
|
||
$values = $foo->getInt32PackedField(); | ||
var_dump(count($values)); | ||
var_dump($values[0]); | ||
var_dump($values[1]); | ||
var_dump($values[2]); | ||
?> | ||
--EXPECT-- | ||
float(3) | ||
string(1) "4" | ||
int(3) | ||
int(2) | ||
int(3) | ||
int(4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--TEST-- | ||
Protocol Buffers appending object value | ||
--SKIPIF-- | ||
<?php require 'skipif.inc' ?> | ||
--FILE-- | ||
<?php | ||
require 'Foo.php'; | ||
require 'Bar.php'; | ||
|
||
$barDestructed = false; | ||
|
||
class SpiedBar extends Bar { | ||
public function __destruct() { | ||
global $barDestructed; | ||
$barDestructed = true; | ||
} | ||
} | ||
|
||
$bar = new SpiedBar(); | ||
$bar->setDoubleField(1.0); | ||
|
||
$foo = new Foo(); | ||
$foo->appendRepeatedObjField($bar); | ||
|
||
$values = $foo->getRepeatedObjField(); | ||
var_dump(count($values)); | ||
var_dump($values[0] === $bar); | ||
$values = null; | ||
|
||
$foo->clearRepeatedObjField(); | ||
var_dump($barDestructed); | ||
|
||
$bar = null; | ||
var_dump($barDestructed); | ||
?> | ||
--EXPECT-- | ||
int(1) | ||
bool(true) | ||
bool(false) | ||
bool(true) |
Oops, something went wrong.