protected function QueryTestBase::assertResponseBody in GraphQL 8
Same name and namespace in other branches
- 8.2 src/Tests/QueryTestBase.php \Drupal\graphql\Tests\QueryTestBase::assertResponseBody()
 
Check to see if the HTTP request response body is identical to the expected value.
Parameters
array $expected: The expected value as an array.
$actual: The actual value.
string $message: (optional) A message to display with the assertion. Do not translate messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed variables in the message text, not t(). If left blank, a default message will be displayed.
string $group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.
Return value
bool TRUE if the assertion succeeded, FALSE otherwise.
1 call to QueryTestBase::assertResponseBody()
- EntityQueryTest::testSingleNodeQuery in src/
Tests/ EntityQueryTest.php  - Helper function to issue a HTTP request with simpletest's cURL.
 
File
- src/
Tests/ QueryTestBase.php, line 98  
Class
- QueryTestBase
 - Test helper class for GraphQL query tests.
 
Namespace
Drupal\graphql\TestsCode
protected function assertResponseBody(array $expected, $actual, $message = '', $group = 'GraphQL Response') {
  $expected = json_decode(json_encode($expected));
  $actual = json_decode($actual);
  return $this
    ->assertEqual($expected, $actual, $message ? $message : strtr('Response body @expected (expected) is equal to @response (actual).', array(
    '@expected' => var_export($expected, TRUE),
    '@response' => var_export($actual, TRUE),
  )), $group);
}