/**
  * @param  string    $name
  * @return ArrayNode
  */
 public function createArrayNode($name)
 {
     $array = new ArrayNode();
     Document::setProperty($array, 'name', $name);
     Document::setProperty($array, 'document', $this);
     return $array;
 }
 public function testArrayNodeDocumentSave()
 {
     $document = Document::createArrayNodeBased();
     $node1 = $document->createValueNode('node1');
     $node1->setValue('node1');
     $document->addNode($node1);
     $node2 = $document->createValueNode('node2');
     $node2->setValue('node2');
     $document->addNode($node2);
     $node3 = $document->createValueNode('node3');
     $node3->setValue('node3');
     $document->addNode($node3);
     $object1 = $document->createObjectNode('object');
     $document->addNode($object1);
     $node11 = $document->createValueNode('node1');
     $node11->setValue('node1');
     $object1->addNode($node11);
     $node12 = $document->createValueNode('node2');
     $node12->setValue('node2');
     $object1->addNode($node12);
     $node13 = $document->createValueNode('node3');
     $node13->setValue('node3');
     $object1->addNode($node13);
     $json = $document->save();
     $this->assertEquals('["node1","node2","node3",{"node1":"node1","node2":"node2","node3":"node3"}]', $json);
 }