Пример #1
0
def test_php_object_name():
    o = PhpObject('Zend\\Object')
    assert php_serialize(o) == b'O:11:"Zend\\Object":0:{}'
Пример #2
0
def test_php_serialize():
    assert php_serialize([b'foo', u'bar', 42, 2.5, True, None, {'a': 'b'}]) == \
        b'a:7:{i:0;s:3:"foo";i:1;s:3:"bar";i:2;i:42;i:3;d:2.5;i:4;b:1;i:5;N;i:6;a:1:{s:1:"a";s:1:"b";}}'
Пример #3
0
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;}'
Пример #4
0
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;}'
Пример #5
0
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;}'