Skip to content

Commit

Permalink
Product media_gallery_entries / types only present if image, thumbnai…
Browse files Browse the repository at this point in the history
…l, small_image is requested
  • Loading branch information
XxXgeoXxX committed Jun 11, 2019
1 parent bb5ae76 commit b776ec3
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,33 @@ public function testProductSmallImageUrlWithExistingImage()
self::assertTrue($this->checkImageExists($response['products']['items'][0]['small_image']['url']));
}

/**
* @magentoApiDataFixture Magento/Catalog/_files/product_with_image.php
*/
public function testProductMediaGalleryEntries()
{
$productSku = 'simple';
$query = <<<QUERY
{
products(filter: {sku: {eq: "{$productSku}"}}) {
items {
name
sku
media_gallery_entries {
id
file
types
}
}
}
}
QUERY;
$response = $this->graphQlQuery($query);

self::assertArrayHasKey('file', $response['products']['items'][0]['media_gallery_entries'][0]);
self::assertContains('magento_image.jpg', $response['products']['items'][0]['media_gallery_entries'][0]['url']);
}

/**
* @param string $url
* @return bool
Expand Down

0 comments on commit b776ec3

Please sign in to comment.