Skip to content

Commit

Permalink
Removes features, adds insights response
Browse files Browse the repository at this point in the history
  • Loading branch information
typhonius committed Nov 24, 2017
1 parent af82b4c commit b22d940
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 10 deletions.
9 changes: 0 additions & 9 deletions src/CloudApi/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,6 @@ public function code($uuid)
return new BranchesResponse($this->connector->request('get', "/applications/${uuid}/code", $this->query));
}

/**
* @param string $uuid
* @return StreamInterface
*/
public function features($uuid)
{
return $this->connector->request('get', "/applications/${uuid}/features", $this->query);
}

/**
* Shows all databases in an application.
*
Expand Down
4 changes: 3 additions & 1 deletion src/Response/ApplicationResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public function __construct($application)
$this->hosting = $application->hosting;
$this->subscription = $application->subscription;
$this->organization = $application->organization;
$this->type = $application->type;
if (property_exists($application, 'type')) {
$this->type = $application->type;
}
$this->flags = $application->flags;
$this->status = $application->status;
$this->links = $application->_links;
Expand Down
20 changes: 20 additions & 0 deletions tests/Endpoints/InsightsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,24 @@ public function testGetInsights()
}
}
}

public function testGetEnvironmentInsights()
{
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getEnvironmentInsights.json');
$client = $this->getMockClient($response);

/** @var AcquiaCloudApi\CloudApi\Client $client */
$result = $client->environmentInsights('14-0c7e79ab-1c4a-424e-8446-76ae8be7e851');

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

foreach ($result as $record) {
$this->assertInstanceOf('\AcquiaCloudApi\Response\InsightResponse', $record);

foreach ($this->properties as $property) {
$this->assertObjectHasAttribute($property, $record);
}
}
}
}
127 changes: 127 additions & 0 deletions tests/Fixtures/Endpoints/getEnvironmentInsights.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"total": 2,
"_links": {
"self": {
"href": "{baseUri}/applications/12345678-abcd-9012-efgh-345678901223/insight"
},
"parent": {
"href": "{baseUri}/applications/12345678-abcd-9012-efgh-345678901223"
}
},
"_embedded": {
"items": [
{
"uuid": "09876543-dcba-210e-fghi-123456789012",
"label": "Example local development",
"hostname": "local.example.com:8443",
"status": "ok",
"updated_at": "2011-03-28T13:28:00-05:00",
"last_connected_at": "2011-03-28T13:11:00-05:00",
"scores": {
"insight": "62",
"seo": "15"
},
"counts": {
"best_practices": {
"pass": 5,
"fail": 1,
"ignored": 0,
"total": 6,
"percent": 83
},
"performance": {
"pass": 9,
"fail": 10,
"ignored": 0,
"total": 19,
"percent": 47
},
"security": {
"pass": 10,
"fail": 10,
"ignored": 0,
"total": 20,
"percent": 50
}
},
"flags": {
"acquia_hosted": false,
"revoked": true
},
"_links": {
"self": {
"href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012"
},
"alerts": {
"href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012/alerts"
},
"connection-history": {
"href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012/connection-history"
},
"modules": {
"href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012/modules"
},
"score-history": {
"href": "{baseUri}/insight/09876543-dcba-210e-fghi-123456789012/score-history"
}
}
},
{
"uuid": "19876543-dcba-210e-fghi-12345678903",
"label": "Test Site: prod",
"hostname": "test.example.com",
"status": "ok",
"updated_at": "2017-03-28T13:28:00-05:00",
"last_connected_at": "2017-03-28T13:11:00-05:00",
"scores": {
"insight": "62",
"seo": "15"
},
"counts": {
"best_practices": {
"pass": 5,
"fail": 1,
"ignored": 0,
"total": 6,
"percent": 83
},
"performance": {
"pass": 10,
"fail": 9,
"ignored": 0,
"total": 19,
"percent": 53
},
"security": {
"pass": 11,
"fail": 9,
"ignored": 0,
"total": 20,
"percent": 55
}
},
"flags": {
"acquia_hosted": true,
"revoked": true
},
"_links": {
"self": {
"href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903"
},
"alerts": {
"href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903/alerts"
},
"connection-history": {
"href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903/connection-history"
},
"modules": {
"href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903/modules"
},
"score-history": {
"href": "{baseUri}/insight/19876543-dcba-210e-fghi-12345678903/score-history"
}
}
}
]
}
}

0 comments on commit b22d940

Please sign in to comment.