Skip to content

Commit b776ec3

Browse files
committed
Product media_gallery_entries / types only present if image, thumbnail, small_image is requested
1 parent bb5ae76 commit b776ec3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/MediaGalleryTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,33 @@ public function testProductSmallImageUrlWithExistingImage()
4545
self::assertTrue($this->checkImageExists($response['products']['items'][0]['small_image']['url']));
4646
}
4747

48+
/**
49+
* @magentoApiDataFixture Magento/Catalog/_files/product_with_image.php
50+
*/
51+
public function testProductMediaGalleryEntries()
52+
{
53+
$productSku = 'simple';
54+
$query = <<<QUERY
55+
{
56+
products(filter: {sku: {eq: "{$productSku}"}}) {
57+
items {
58+
name
59+
sku
60+
media_gallery_entries {
61+
id
62+
file
63+
types
64+
}
65+
}
66+
}
67+
}
68+
QUERY;
69+
$response = $this->graphQlQuery($query);
70+
71+
self::assertArrayHasKey('file', $response['products']['items'][0]['media_gallery_entries'][0]);
72+
self::assertContains('magento_image.jpg', $response['products']['items'][0]['media_gallery_entries'][0]['url']);
73+
}
74+
4875
/**
4976
* @param string $url
5077
* @return bool

0 commit comments

Comments
 (0)