public function EntityMultipleTest::testResolveEntityLoadMultiple in GraphQL 8.4
@covers \Drupal\graphql\Plugin\GraphQL\DataProducer\Entity\EntityLoadMultiple::resolve
File
- tests/
src/ Kernel/ DataProducer/ EntityMultipleTest.php, line 90
Class
- EntityMultipleTest
- Data producers Entity multiple test class.
Namespace
Drupal\Tests\graphql\Kernel\DataProducerCode
public function testResolveEntityLoadMultiple() : void {
$result = $this
->executeDataProducer('entity_load_multiple', [
'type' => $this->node1
->getEntityTypeId(),
'bundles' => [
$this->node1
->bundle(),
$this->node2
->bundle(),
],
'ids' => [
$this->node1
->id(),
$this->node2
->id(),
$this->node3
->id(),
],
// @todo We need to set these default values here to make the access
// handling work. Ideally that should not be needed.
'access' => TRUE,
'access_operation' => 'view',
]);
$nids = array_values(array_map(function (NodeInterface $item) {
return $item
->id();
}, $result));
// All entity is loaded through entity load should match the initial values.
// Hidden entity (node 3) is not include
// because access checking will not return it.
$this
->assertEquals([
$this->node1
->id(),
$this->node2
->id(),
], $nids);
}