You are here

public function ImageUrlTest::testImageUrl in GraphQL 8.4

@covers \Drupal\graphql\Plugin\GraphQL\DataProducer\Entity\Fields\Image\ImageUrl::resolve

File

tests/src/Kernel/DataProducer/Entity/Fields/Image/ImageUrlTest.php, line 44

Class

ImageUrlTest
Test class for the ImageUrl data producer.

Namespace

Drupal\Tests\graphql\Kernel\DataProducer\Entity\Fields\Image

Code

public function testImageUrl() : void {

  // Test that we get a file we have access to.
  $result = $this
    ->executeDataProducer('image_url', [
    'entity' => $this->file,
  ]);
  $this
    ->assertEquals($this->file_url, $result);

  // @todo Add cache checks.
  // $this->assertContains('test_tag', $metadata->getCacheTags());
  // Test that we do not get a file we don't have access to, but the cache
  // tags are still added.
  $result = $this
    ->executeDataProducer('image_url', [
    'entity' => $this->file_not_accessible,
  ]);
  $this
    ->assertNull($result);

  // @todo Add cache checks.
  // $this->assertContains('test_tag_forbidden',
  // $metadata->getCacheTags());
}