Beispiel #1
0
 public function testAddGroupSettingMultiple()
 {
     $settingKey = "tagColors";
     $value = array(array("name" => "_READ", "color" => "#990000"));
     // TODO: multiple, once more settings are supported
     $groupID = self::$config['ownedPrivateGroupID'];
     $libraryVersion = API::getGroupLibraryVersion($groupID);
     $json = array($settingKey => array("value" => $value));
     $response = API::groupPost($groupID, "settings", json_encode($json), array("Content-Type: application/json"));
     $this->assert204($response);
     // Multi-object GET
     $response = API::groupGet($groupID, "settings");
     $this->assert200($response);
     $this->assertContentType("application/json", $response);
     $json = json_decode($response->getBody(), true);
     $this->assertNotNull($json);
     $this->assertArrayHasKey($settingKey, $json);
     $this->assertEquals($value, $json[$settingKey]['value']);
     $this->assertEquals($libraryVersion + 1, $json[$settingKey]['version']);
     // Single-object GET
     $response = API::groupGet($groupID, "settings/{$settingKey}");
     $this->assert200($response);
     $this->assertContentType("application/json", $response);
     $json = json_decode($response->getBody(), true);
     $this->assertNotNull($json);
     $this->assertEquals($value, $json['value']);
     $this->assertEquals($libraryVersion + 1, $json['version']);
 }