Skip to content

Commit f01d084

Browse files
committed
Merge branch '2.3-develop##612' of github.com:XxXgeoXxX/graphql-ce into 612-skip
2 parents dffe94d + b776ec3 commit f01d084

File tree

2 files changed

+28
-1
lines changed
  • app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider
  • dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog

2 files changed

+28
-1
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function getList(
7474
): SearchResultsInterface {
7575
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $collection */
7676
$collection = $this->collectionFactory->create();
77-
77+
$attributes = array_unique(array_merge($attributes, ['small_image', 'thumbnail', 'image']));
7878
$this->collectionProcessor->process($collection, $searchCriteria, $attributes);
7979

8080
if (!$isChildSearch) {

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)