Exemplo n.º 1
0
 public function testUserGroupsOwned()
 {
     $response = API::get("users/" . self::$config['userID'] . "/groups?content=json" . "&key=" . self::$config['apiKey']);
     $this->assert200($response);
     $this->assertNumResults(self::$config['numOwnedGroups'], $response);
     $this->assertTotalResults(self::$config['numOwnedGroups'], $response);
 }
Exemplo n.º 2
0
 public function testComputerProgramVersion()
 {
     $response = API::get("items/new?itemType=computerProgram");
     $this->assert200($response);
     $json = json_decode($response->getBody());
     $this->assertObjectHasAttribute('version', $json);
     $this->assertObjectNotHasAttribute('versionNumber', $json);
     $response = API::get("itemTypeFields?itemType=computerProgram");
     $this->assert200($response);
     $json = json_decode($response->getBody());
     $fields = array_map(function ($val) {
         return $val->field;
     }, $json);
     $this->assertContains('version', $fields);
     $this->assertNotContains('versionNumber', $fields);
 }
Exemplo n.º 3
0
 /**
  * @depends testNewEmptyBookItem
  */
 public function testNewAttachmentItemModTimeOnLinkedURL($newItemData)
 {
     $parentKey = $newItemData['key'];
     $response = API::get("items/new?itemType=attachment&linkMode=linked_url");
     $json = json_decode($response->getBody());
     $json->parentItem = $parentKey;
     $json->mtime = "1332807793000";
     $response = API::userPost(self::$config['userID'], "items?key=" . self::$config['apiKey'], json_encode(array("items" => array($json))), array("Content-Type: application/json"));
     $this->assert400ForObject($response, "'mtime' is valid only for imported attachment items");
 }