Skip to content

Commit

Permalink
Adding modify environment method
Browse files Browse the repository at this point in the history
  • Loading branch information
timmillwood authored and Adam Malone committed Nov 11, 2019
1 parent 9b09edd commit b1dd447
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/CloudApi/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,30 @@ public function environment($environmentUuid)
);
}

/**
* Modifies configuration settings for an environment.
*
* @param string $environmentUuid
* @param array $config
* @return OperationResponse
*/
public function modifyEnvironment($environmentUuid, array $config)
{

$options = [
'form_params' => $config,
];

return new OperationResponse(
$this->connector->request(
'put',
"/environments/${environmentUuid}",
$this->query,
$options
)
);
}

/**
* Renames an environment.
*
Expand Down
9 changes: 9 additions & 0 deletions src/CloudApi/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@ public function environments($applicationUuid);
*/
public function environment($environmentUuid);

/**
* Modifies configuration settings for an environment.
*
* @param string $environmentUuid
* @param array $config
* @return OperationResponse
*/
public function modifyEnvironment($environmentUuid, array $config);

/**
* Renames an environment.
*
Expand Down
14 changes: 14 additions & 0 deletions tests/Endpoints/EnvironmentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ public function testGetEnvironment()
}
}

public function testModifyEnvironment()
{
$response = $this->getPsr7JsonResponseForFixture('Endpoints/modifyEnvironment.json');

$client = $this->getMockClient($response);

/** @var \AcquiaCloudApi\CloudApi\ClientInterface $client */
$result = $client->modifyEnvironment('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', ['version' => '7.2']);

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

$this->assertEquals('The environment configuration is being updated.', $result->message);
}

public function testRenameEnvironment()
{
$response = $this->getPsr7JsonResponseForFixture('Endpoints/renameEnvironment.json');
Expand Down
3 changes: 3 additions & 0 deletions tests/Fixtures/Endpoints/modifyEnvironment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message": "The environment configuration is being updated."
}

0 comments on commit b1dd447

Please sign in to comment.