File: issue091.phpt

package info (click to toggle)
php-msgpack 1%3A2.2.0~rc2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,200 kB
  • sloc: ansic: 3,817; xml: 416; makefile: 2
file content (51 lines) | stat: -rw-r--r-- 751 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--TEST--
Issue #91 (private property in base class)
--SKIPIF--
<?php
if (!extension_loaded("msgpack")) {
    die("skip");
}
?>
--FILE--
<?php
class TestBase
{
  private $name = 'default';

  public function getName()
  {
    return $this->name;
  }

  public function setName($name)
  {
    $this->name = $name;
  }
}

class Test extends TestBase
{

}

$test = new Test();

$test->setName('new-name');
var_dump($test, $test->getName());

$new_test = msgpack_unpack(msgpack_pack($test));
var_dump($new_test, $new_test->getName());
?>
OK
--EXPECTF--
object(Test)#%d (1) {
  ["name":"TestBase":private]=>
  string(8) "new-name"
}
string(8) "new-name"
object(Test)#%d (1) {
  ["name":"TestBase":private]=>
  string(8) "new-name"
}
string(8) "new-name"
OK