public function EntityFieldValueTest::testFilteredText in GraphQL 8.3
Test filtered text fields.
File
- modules/
graphql_core/ tests/ src/ Kernel/ Entity/ EntityFieldValueTest.php, line 123
Class
- EntityFieldValueTest
- Test basic entity fields.
Namespace
Drupal\Tests\graphql_core\Kernel\EntityCode
public function testFilteredText() {
$this
->mockNode([
'body' => [
'value' => 'http://www.drupal.org',
'format' => 'plain_text',
],
]);
$this
->assertGraphQLFields([
[
'NodeTest',
'body',
'FieldNodeTestBody',
],
[
'FieldNodeTestBody',
'format',
'String',
],
[
'FieldNodeTestBody',
'value',
'String',
],
[
'FieldNodeTestBody',
'processed',
'String',
],
[
'FieldNodeTestBody',
'summary',
'String',
],
[
'FieldNodeTestBody',
'summaryProcessed',
'String',
],
]);
$query = <<<GQL
query {
node {
body {
value
processed
summary
summaryProcessed
}
}
}
GQL;
$metadata = $this
->defaultCacheMetaData();
$this
->assertResults($query, [], [
'node' => [
'body' => [
'value' => 'http://www.drupal.org',
'processed' => "<p><a href=\"http://www.drupal.org\">http://www.drupal.org</a></p>\n",
'summary' => null,
'summaryProcessed' => '',
],
],
], $metadata);
}