Skip to content

Commit b337206

Browse files
committed
MAGETWO-83853: GraphQL response returns null for website_ids, url_path
- assert websites
1 parent ae82a52 commit b337206

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ public function testQueryAllFieldsSimpleProduct()
265265
$this->assertEavAttributes($product, $response['products']['items'][0]);
266266
$this->assertOptions($product, $response['products']['items'][0]);
267267
$this->assertTierPrices($product, $response['products']['items'][0]);
268+
$this->assertArrayHasKey('websites', $response['products']['items'][0]);
269+
$this->assertWebsites($product, $response['products']['items'][0]['websites']);
268270
self::assertEquals(
269271
'Movable Position 2',
270272
$responseObject->getData('products/items/0/categories/1/name')
@@ -495,6 +497,8 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct()
495497
$this->assertEquals(1, count($response['products']['items']));
496498
$this->assertArrayHasKey(0, $response['products']['items']);
497499
$this->assertMediaGalleryEntries($product, $response['products']['items'][0]);
500+
$this->assertArrayHasKey('websites', $response['products']['items'][0]);
501+
$this->assertWebsites($product, $response['products']['items'][0]['websites']);
498502
}
499503

500504
/**
@@ -866,6 +870,26 @@ private function assertBaseFields($product, $actualResponse)
866870
$this->assertResponseFields($actualResponse, $assertionMap);
867871
}
868872

873+
/**
874+
* @param ProductInterface $product
875+
* @param array $actualResponse
876+
*/
877+
private function assertWebsites($product, $actualResponse)
878+
{
879+
$assertionMap = [
880+
[
881+
'id' => current($product->getExtensionAttributes()->getWebsiteIds()),
882+
'name' => 'Main Website',
883+
'code' => 'base',
884+
'sort_order' => 0,
885+
'default_group_id' => '1',
886+
'is_default' => true,
887+
]
888+
];
889+
890+
$this->assertEquals($actualResponse, $assertionMap);
891+
}
892+
869893
/**
870894
* @param ProductInterface $product
871895
* @param array $actualResponse

0 commit comments

Comments
 (0)