function testFillDatabases() { $json = file_get_contents(__DIR__ . '/' . $this->fixturesFolder . '/get-database.json'); $jsonObj = json_decode($json); $database = new Database(); $database->setTitle($jsonObj->title); $database->setSize($jsonObj->size); $database->setRevision($jsonObj->revision); $database->setRecordsCount($jsonObj->records_count); $database->setModified($jsonObj->modified); $database->setCreated($jsonObj->modified); $databases = new Databases(); $databases->add($database); $arrayDiff = array_diff($databases->current()->toArray(), json_decode($json, true)); $this->assertTrue(empty($arrayDiff), 'Is Equals arrays'); }
/** * @param string $title * @param null $databaseId * @param null $context * @param array $fields * * @return Database * @throws DataSyncException * @throws ForbiddenException * @throws IncorrectDataFormatException * @throws InvalidArgumentException * @throws MaxDatabasesCountException * @throws NotFoundException * @throws TooManyRequestsException * @throws UnauthorizedException * @throws UnavailableResourceException */ public function updateDatabaseTitle($title, $databaseId = null, $context = null, $fields = []) { $response = $this->sendRequest('PATCH', $this->getDatabaseUrl($databaseId, $context, $fields), ['json' => ['title' => $title]]); $decodedResponseBody = $this->getDecodedBody($response->getBody()); $database = new Database($decodedResponseBody); $database->setContext($this->getContext()); return $database; }