Skip to content

Commit

Permalink
Merge 2d9ade8 into c5f0d34
Browse files Browse the repository at this point in the history
  • Loading branch information
q0rban committed Dec 18, 2018
2 parents c5f0d34 + 2d9ade8 commit 5c15bad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/CloudApi/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,16 @@ public function databaseBackups($environmentUuid, $dbName)
* Gets information about a database backup.
*
* @param string $environmentUuid
* @param string $dbName
* @param int $backupId
* @return BackupResponse
*/
public function databaseBackup($environmentUuid, $backupId)
public function databaseBackup($environmentUuid, $dbName, $backupId)
{
return new BackupResponse(
$this->connector->request(
'get',
"/environments/${environmentUuid}/database-backups/${backupId}",
"/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}",
$this->query
)
);
Expand All @@ -310,15 +311,16 @@ public function databaseBackup($environmentUuid, $backupId)
* Restores a database backup to a database in an environment.
*
* @param string $environmentUuid
* @param string $dbName
* @param int $backupId
* @return OperationResponse
*/
public function restoreDatabaseBackup($environmentUuid, $backupId)
public function restoreDatabaseBackup($environmentUuid, $dbName, $backupId)
{
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/database-backups/${backupId}/actions/restore",
"/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}/actions/restore",
$this->query
)
);
Expand Down
6 changes: 4 additions & 2 deletions src/CloudApi/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,21 @@ public function databaseBackups($environmentUuid, $dbName);
* Gets information about a database backup.
*
* @param string $environmentUuid
* @param string $dbName
* @param int $backupId
* @return BackupResponse
*/
public function databaseBackup($environmentUuid, $backupId);
public function databaseBackup($environmentUuid, $dbName, $backupId);

/**
* Restores a database backup to a database in an environment.
*
* @param string $environmentUuid
* @param string $dbName
* @param int $backupId
* @return OperationResponse
*/
public function restoreDatabaseBackup($environmentUuid, $backupId);
public function restoreDatabaseBackup($environmentUuid, $dbName, $backupId);

/**
* Copies files from an environment to another environment.
Expand Down
4 changes: 2 additions & 2 deletions tests/Endpoints/DatabasesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function testGetDatabaseBackup()
$client = $this->getMockClient($response);

/** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */
$result = $client->databaseBackup('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 12);
$result = $client->databaseBackup('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'db_name', 12);

$this->assertNotInstanceOf('\AcquiaCloudApi\Response\BackupsResponse', $result);
$this->assertInstanceOf('\AcquiaCloudApi\Response\BackupResponse', $result);
Expand All @@ -152,7 +152,7 @@ public function testRestoreDatabaseBackup()
$client = $this->getMockClient($response);

/** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */
$result = $client->restoreDatabaseBackup('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 12);
$result = $client->restoreDatabaseBackup('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', 'db_name', 12);

$this->assertInstanceOf('\AcquiaCloudApi\Response\OperationResponse', $result);

Expand Down

0 comments on commit 5c15bad

Please sign in to comment.