EntityRevisionsTest.php in GraphQL 8.3
File
modules/graphql_core/tests/src/Kernel/Entity/EntityRevisionsTest.php
View source
<?php
namespace Drupal\Tests\graphql_core\Kernel\Context;
use Drupal\node\Entity\Node;
use Drupal\Tests\graphql_core\Kernel\GraphQLContentTestBase;
class EntityRevisionsTest extends GraphQLContentTestBase {
public function testNodeContext() {
$node = Node::create([
'title' => 'Test',
'type' => 'test',
]);
$nodeId = $node
->save();
$draft = $this
->getNewDraft($node);
$draft
->save();
$query = <<<GQL
query (\$path: String!) {
route(path: \$path) {
... on EntityCanonicalUrl {
entity {
... on EntityRevisionable {
entityRevisions {
count
}
}
}
}
}
}
GQL;
$this
->query($query, [
'path' => '/node/' . $nodeId,
]);
}
}