def test_php_object_name(): o = PhpObject('Zend\\Object') assert php_serialize(o) == b'O:11:"Zend\\Object":0:{}'
def test_php_object_get_item_protected(): o = PhpObject('Test', {'protected a': 42}) assert o['protected a'] == 42 assert o['\0*\0a'] == 42
def test_php_object_get_item_private(): o = PhpObject('Test', {'private a': 42}) assert o['private a'] == 42 assert o['Testa'] == 42
def test_php_object_get_item_public(): o = PhpObject('Test', {'public a': 42}) assert o['a'] == 42 assert o['public a'] == 42
def test_php_object_get_item(): o = PhpObject('', {'a': 42}) assert o['a'] == 42
def test_php_object_private_property(): o = PhpObject('Test', {'private a': 42}) assert php_serialize(o) == b'O:4:"Test":1:{s:5:"Testa";i:42;}'
def test_php_object_protected_property(): o = PhpObject('Test', {'protected a': 42}) assert php_serialize(o) == b'O:4:"Test":1:{s:4:"\0*\0a";i:42;}'
def test_php_object_public_property(): o = PhpObject('Test', {'public a': 42}) assert php_serialize(o) == b'O:4:"Test":1:{s:1:"a";i:42;}'