Skip to content

Commit

Permalink
chore(dataproducer): fix tests (drupal-graphql#1382)
Browse files Browse the repository at this point in the history
  • Loading branch information
edurenye committed Dec 4, 2023
1 parent 70b2f55 commit 85377f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Plugin/GraphQL/DataProducer/Entity/EntityLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ class EntityLabel extends DataProducerPluginBase implements DataProducerPluginCa
* Resolver.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* @param bool|null $access
* @param bool $access
* @param \Drupal\Core\Session\AccountInterface|null $accessUser
* @param \Drupal\graphql\GraphQL\Execution\FieldContext $context
*
* @return string|null
*/
public function resolve(EntityInterface $entity, ?bool $access, ?AccountInterface $accessUser, FieldContext $context) {
public function resolve(EntityInterface $entity, bool $access, ?AccountInterface $accessUser, FieldContext $context) {
if ($access) {
/** @var \Drupal\Core\Access\AccessResultInterface $accessResult */
$accessResult = $entity->access('view label', $accessUser, TRUE);
Expand Down
4 changes: 4 additions & 0 deletions tests/src/Kernel/DataProducer/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,14 @@ public function testResolveLabel(): void {

$this->assertEquals('Dummy label', $this->executeDataProducer('entity_label', [
'entity' => $this->entity,
// @todo Remove when https://github.com/drupal-graphql/graphql/issues/1233 is fixed.
'access' => TRUE,
]));

$this->assertNull($this->executeDataProducer('entity_label', [
'entity' => $this->entity,
// @todo Remove when https://github.com/drupal-graphql/graphql/issues/1233 is fixed.
'access' => TRUE,
]));
}

Expand Down

0 comments on commit 85377f7

Please sign in to comment.