Skip to content
Snippets Groups Projects
Commit 8231f1ef authored by Vincent Petry's avatar Vincent Petry Committed by Andreas Fischer
Browse files

Added test of OCS privatedata to trigger key duplication

parent d8bd8c4b
No related branches found
No related tags found
No related merge requests found
......@@ -79,6 +79,31 @@ class Test_OC_OCS_Privatedata extends PHPUnit_Framework_TestCase
$this->assertEquals('updated', $data['value']);
}
public function testSetSameValue() {
$_POST = array('value' => 123456789);
$params = array('app' => $this->appKey, 'key' => 'k-10');
$result = OC_OCS_Privatedata::set($params);
$this->assertEquals(100, $result->getStatusCode());
$result = OC_OCS_Privatedata::get($params);
$this->assertOcsResult(1, $result);
$data = $result->getData();
$data = $data[0];
$this->assertEquals('123456789', $data['value']);
// set the same value again
$_POST = array('value' => 123456789);
$params = array('app' => $this->appKey, 'key' => 'k-10');
$result = OC_OCS_Privatedata::set($params);
$this->assertEquals(100, $result->getStatusCode());
$result = OC_OCS_Privatedata::get($params);
$this->assertOcsResult(1, $result);
$data = $result->getData();
$data = $data[0];
$this->assertEquals('123456789', $data['value']);
}
public function testSetMany() {
$_POST = array('value' => 123456789);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment