function testWrapCommandResultEncodesResult()
 {
     $result = new tx_caretakerinstance_CommandResult(true, new tx_caretakerinstance_OperationResult(true, array('foo' => 'bar')));
     $data = $result->toJson();
     $this->securityManager->expects($this->once())->method('encodeResult')->with($this->equalTo($data))->will($this->returnValue('Encoded result data'));
     $wrap = $this->commandService->wrapCommandResult($result);
     $this->assertEquals('Encoded result data', $wrap);
 }
 function testCommandResultToJsonCreatesJson()
 {
     $result = new tx_caretakerinstance_CommandResult(true, array(new tx_caretakerinstance_OperationResult(true, 'foo'), new tx_caretakerinstance_OperationResult(true, false), new tx_caretakerinstance_OperationResult(true, array('foo', 'bar'))), 'Test message');
     $json = $result->toJson();
     $this->assertEquals('{"status":0,"results":[{"status":true,"value":"foo"},{"status":true,"value":false},{"status":true,"value":["foo","bar"]}],"message":"Test message"}', $json);
 }
 /**
  * Encode / encrypt the command result with the security manager
  *
  * @param tx_caretakerinstance_CommandResult $commandResult
  * @return string
  */
 public function wrapCommandResult(tx_caretakerinstance_CommandResult $commandResult)
 {
     $json = $commandResult->toJson();
     return $this->securityManager->encodeResult($json);
 }