You are here

private function RequestTestBase::saveExpectationFile in OpenAPI 8.2

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 RequestTestBase::saveExpectationFile()
RequestTestBase::requestOpenApiJson in tests/src/Functional/RequestTestBase.php
Makes OpenAPI request and checks the response.

File

tests/src/Functional/RequestTestBase.php, line 347

Class

RequestTestBase
Base tests for requests on OpenAPI routes.

Namespace

Drupal\Tests\openapi\Functional

Code

private 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);
}