Пример #1
0
 public function testParseComplexObject()
 {
     $complexObject = new TestClass();
     $childObject = new TestClass();
     $childObject->setFoo(array('foobar', 'foo' => 'bar'));
     $childObject->setBar(new \stdClass());
     $complexObject->setFoo($childObject);
     $complexObject->setBar(23);
     $this->assertEquals(new Node\ObjectNode(array(new Node\AttributeNode(new Node\ObjectNode(array(new Node\AttributeNode(new Node\ArrayNode(array(new Node\ArrayElementNode(new Node\StringNode('foobar'), new Node\IntegerNode(0)), new Node\ArrayElementNode(new Node\StringNode('bar'), new Node\StringNode('foo')))), 'Qafoo\\SerPretty\\TestClass', 'foo', Node\AttributeNode::SCOPE_PRIVATE), new Node\AttributeNode(new Node\ObjectNode(array(), 'stdClass'), null, 'bar', Node\AttributeNode::SCOPE_PUBLIC), new Node\AttributeNode(new Node\BooleanNode(true), '*', 'baz', Node\AttributeNode::SCOPE_PROTECTED)), 'Qafoo\\SerPretty\\TestClass'), 'Qafoo\\SerPretty\\TestClass', 'foo', Node\AttributeNode::SCOPE_PRIVATE), new Node\AttributeNode(new Node\IntegerNode(23), null, 'bar', Node\AttributeNode::SCOPE_PUBLIC), new Node\AttributeNode(new Node\BooleanNode(true), '*', 'baz', Node\AttributeNode::SCOPE_PROTECTED)), 'Qafoo\\SerPretty\\TestClass'), $this->parser->parse(serialize($complexObject)));
 }