Skip to content

Commit d054100

Browse files
committed
MAGETWO-89246: Product visibility is not considered in search
- uncommented tests
1 parent 1afdfc7 commit d054100

File tree

3 files changed

+256
-255
lines changed

3 files changed

+256
-255
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php

Lines changed: 146 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -210,150 +210,150 @@ private function assertResponseFields($actualResponse, $assertionMap)
210210
}
211211
}
212212

213-
// /**
214-
// * @magentoApiDataFixture Magento/Bundle/_files/product_with_multiple_options_1.php
215-
// */
216-
// public function testAndMaxMinPriceBundleProduct()
217-
// {
218-
// $productSku = 'bundle-product';
219-
// $query
220-
// = <<<QUERY
221-
//{
222-
// products(filter: {sku: {eq: "{$productSku}"}})
223-
// {
224-
// items{
225-
// id
226-
// type_id
227-
// ... on PhysicalProductInterface {
228-
// weight
229-
// }
230-
// category_ids
231-
// price {
232-
// minimalPrice {
233-
// amount {
234-
// value
235-
// currency
236-
// }
237-
// adjustments {
238-
// amount {
239-
// value
240-
// currency
241-
// }
242-
// code
243-
// description
244-
// }
245-
// }
246-
// maximalPrice {
247-
// amount {
248-
// value
249-
// currency
250-
// }
251-
// adjustments {
252-
// amount {
253-
// value
254-
// currency
255-
// }
256-
// code
257-
// description
258-
// }
259-
// }
260-
// regularPrice {
261-
// amount {
262-
// value
263-
// currency
264-
// }
265-
// adjustments {
266-
// amount {
267-
// value
268-
// currency
269-
// }
270-
// code
271-
// description
272-
// }
273-
// }
274-
// }
275-
// ... on BundleProduct {
276-
// dynamic_sku
277-
// dynamic_price
278-
// dynamic_weight
279-
// price_view
280-
// ship_bundle_items
281-
// items {
282-
// options {
283-
// label
284-
// product {
285-
// id
286-
// name
287-
// sku
288-
// }
289-
// }
290-
// }
291-
// }
292-
// }
293-
// }
294-
//}
295-
//QUERY;
296-
// $response = $this->graphQlQuery($query);
297-
//
298-
// /** @var ProductRepositoryInterface $productRepository */
299-
// $productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class);
300-
// $bundleProduct = $productRepository->get($productSku, false, null, true);
301-
// /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */
302-
// $priceInfo = $bundleProduct->getPriceInfo();
303-
// $priceCode = \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE;
304-
// $minimalPrice = $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue();
305-
// $maximalPrice = $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue();
306-
// $this->assertEquals(
307-
// $minimalPrice,
308-
// $response['products']['items'][0]['price']['minimalPrice']['amount']['value']
309-
// );
310-
// $this->assertEquals(
311-
// $maximalPrice,
312-
// $response['products']['items'][0]['price']['maximalPrice']['amount']['value']
313-
// );
314-
// }
315-
//
316-
// /**
317-
// * @magentoApiDataFixture Magento/Bundle/_files/product_1.php
318-
// * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
319-
// */
320-
// public function testNonExistentFieldQtyExceptionOnBundleProduct()
321-
// {
322-
// $productSku = 'bundle-product';
323-
// $query
324-
// = <<<QUERY
325-
//{
326-
// products(filter: {sku: {eq: "{$productSku}"}})
327-
// {
328-
// items{
329-
// id
330-
// type_id
331-
// qty
332-
// ... on PhysicalProductInterface {
333-
// weight
334-
// }
335-
// category_ids
336-
//
337-
// ... on BundleProduct {
338-
// dynamic_sku
339-
// dynamic_price
340-
// dynamic_weight
341-
// price_view
342-
// ship_bundle_items
343-
// bundle_product_links {
344-
// id
345-
// name
346-
// sku
347-
// }
348-
// }
349-
// }
350-
// }
351-
//}
352-
//QUERY;
353-
//
354-
// $this->expectException(\Exception::class);
355-
// $this->expectExceptionMessage('GraphQL response contains errors: Cannot'. ' ' .
356-
// 'query field "qty" on type "ProductInterface".');
357-
// $this->graphQlQuery($query);
358-
// }
213+
/**
214+
* @magentoApiDataFixture Magento/Bundle/_files/product_with_multiple_options_1.php
215+
*/
216+
public function testAndMaxMinPriceBundleProduct()
217+
{
218+
$productSku = 'bundle-product';
219+
$query
220+
= <<<QUERY
221+
{
222+
products(filter: {sku: {eq: "{$productSku}"}})
223+
{
224+
items{
225+
id
226+
type_id
227+
... on PhysicalProductInterface {
228+
weight
229+
}
230+
category_ids
231+
price {
232+
minimalPrice {
233+
amount {
234+
value
235+
currency
236+
}
237+
adjustments {
238+
amount {
239+
value
240+
currency
241+
}
242+
code
243+
description
244+
}
245+
}
246+
maximalPrice {
247+
amount {
248+
value
249+
currency
250+
}
251+
adjustments {
252+
amount {
253+
value
254+
currency
255+
}
256+
code
257+
description
258+
}
259+
}
260+
regularPrice {
261+
amount {
262+
value
263+
currency
264+
}
265+
adjustments {
266+
amount {
267+
value
268+
currency
269+
}
270+
code
271+
description
272+
}
273+
}
274+
}
275+
... on BundleProduct {
276+
dynamic_sku
277+
dynamic_price
278+
dynamic_weight
279+
price_view
280+
ship_bundle_items
281+
items {
282+
options {
283+
label
284+
product {
285+
id
286+
name
287+
sku
288+
}
289+
}
290+
}
291+
}
292+
}
293+
}
294+
}
295+
QUERY;
296+
$response = $this->graphQlQuery($query);
297+
298+
/** @var ProductRepositoryInterface $productRepository */
299+
$productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class);
300+
$bundleProduct = $productRepository->get($productSku, false, null, true);
301+
/** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */
302+
$priceInfo = $bundleProduct->getPriceInfo();
303+
$priceCode = \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE;
304+
$minimalPrice = $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue();
305+
$maximalPrice = $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue();
306+
$this->assertEquals(
307+
$minimalPrice,
308+
$response['products']['items'][0]['price']['minimalPrice']['amount']['value']
309+
);
310+
$this->assertEquals(
311+
$maximalPrice,
312+
$response['products']['items'][0]['price']['maximalPrice']['amount']['value']
313+
);
314+
}
315+
316+
/**
317+
* @magentoApiDataFixture Magento/Bundle/_files/product_1.php
318+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
319+
*/
320+
public function testNonExistentFieldQtyExceptionOnBundleProduct()
321+
{
322+
$productSku = 'bundle-product';
323+
$query
324+
= <<<QUERY
325+
{
326+
products(filter: {sku: {eq: "{$productSku}"}})
327+
{
328+
items{
329+
id
330+
type_id
331+
qty
332+
... on PhysicalProductInterface {
333+
weight
334+
}
335+
category_ids
336+
337+
... on BundleProduct {
338+
dynamic_sku
339+
dynamic_price
340+
dynamic_weight
341+
price_view
342+
ship_bundle_items
343+
bundle_product_links {
344+
id
345+
name
346+
sku
347+
}
348+
}
349+
}
350+
}
351+
}
352+
QUERY;
353+
354+
$this->expectException(\Exception::class);
355+
$this->expectExceptionMessage('GraphQL response contains errors: Cannot'. ' ' .
356+
'query field "qty" on type "ProductInterface".');
357+
$this->graphQlQuery($query);
358+
}
359359
}

0 commit comments

Comments
 (0)