You are here

protected function MonitoringTestTrait::doJsonRequest in Monitoring 8

Do the request.

Parameters

string $action: Action to perform.

array $query: Path query key - value pairs.

Return value

array Decoded json object.

4 calls to MonitoringTestTrait::doJsonRequest()
MonitoringServicesTest::testSensorCaching in tests/src/Functional/MonitoringServicesTest.php
Test sensor dynamic cacheability
MonitoringServicesTest::testSensorConfig in tests/src/Functional/MonitoringServicesTest.php
Test sensor config API calls.
MonitoringServicesTest::testSensorResult in tests/src/Functional/MonitoringServicesTest.php
Test sensor result API calls.
MultigraphServicesTest::testMultigraph in modules/multigraph/tests/src/Functional/MultigraphServicesTest.php
Test multigraph API calls.

File

tests/src/Functional/MonitoringTestTrait.php, line 96

Class

MonitoringTestTrait
Monitoring test helper trait.

Namespace

Drupal\Tests\monitoring\Functional

Code

protected function doJsonRequest($action, $query = array()) {
  $query['_format'] = 'json';
  $this
    ->drupalGet($action, [
    'query' => $query,
  ]);
  return Json::decode((string) $this
    ->getSession()
    ->getPage()
    ->getContent());
}