public function test_To_String()
 {
     $document = new Document();
     $operation = new Operation();
     $operation->setPath('/foo');
     $operation->setType(OperationType::REPLACE);
     $operation->setValue('bar');
     $document->addOperation($operation);
     $this->assertEquals('[{"op": "replace", "path": "/foo", "value": "bar"}]', $document->toString());
 }
 public function test_Escaping_Tilde()
 {
     $property = new Property();
     $property->setName('~foo');
     $operation = new Operation();
     $operation->setPath($property->getPath());
     $operation->setType(OperationType::REPLACE);
     $operation->setValue('bar~baz~');
     $encoded = Encoder::encode(array($operation));
     $this->assertEquals('[{"op": "replace", "path": "/~0foo", "value": "bar~0baz~0"}]', $encoded);
 }