You are here

protected function RequestTest::saveExpectationFile in OpenAPI 8

Saves an expectation file.

Parameters

string $file_name: The file name of the expectation file.

array $decoded_response: The decoded JSON response.

See also

\Drupal\Tests\openapi\Functional\RequestTest::GENERATE_EXPECTATION_FILES

1 call to RequestTest::saveExpectationFile()
RequestTest::requestOpenApiJson in tests/src/Functional/RequestTest.php
Makes OpenAPI request and checks the response.

File

tests/src/Functional/RequestTest.php, line 394

Class

RequestTest
Tests requests OpenAPI routes.

Namespace

Drupal\Tests\openapi\Functional

Code

protected function saveExpectationFile($file_name, array $decoded_response) {

  // Remove the base path from the start of the string, if present.
  $re_encode = json_encode($decoded_response, JSON_PRETTY_PRINT);
  file_put_contents($file_name, $re_encode);
}