@@ -265,6 +265,8 @@ public function testQueryAllFieldsSimpleProduct()
265
265
$ this ->assertEavAttributes ($ product , $ response ['products ' ]['items ' ][0 ]);
266
266
$ this ->assertOptions ($ product , $ response ['products ' ]['items ' ][0 ]);
267
267
$ this ->assertTierPrices ($ product , $ response ['products ' ]['items ' ][0 ]);
268
+ $ this ->assertArrayHasKey ('websites ' , $ response ['products ' ]['items ' ][0 ]);
269
+ $ this ->assertWebsites ($ product , $ response ['products ' ]['items ' ][0 ]['websites ' ]);
268
270
self ::assertEquals (
269
271
'Movable Position 2 ' ,
270
272
$ responseObject ->getData ('products/items/0/categories/1/name ' )
@@ -495,6 +497,8 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct()
495
497
$ this ->assertEquals (1 , count ($ response ['products ' ]['items ' ]));
496
498
$ this ->assertArrayHasKey (0 , $ response ['products ' ]['items ' ]);
497
499
$ this ->assertMediaGalleryEntries ($ product , $ response ['products ' ]['items ' ][0 ]);
500
+ $ this ->assertArrayHasKey ('websites ' , $ response ['products ' ]['items ' ][0 ]);
501
+ $ this ->assertWebsites ($ product , $ response ['products ' ]['items ' ][0 ]['websites ' ]);
498
502
}
499
503
500
504
/**
@@ -866,6 +870,26 @@ private function assertBaseFields($product, $actualResponse)
866
870
$ this ->assertResponseFields ($ actualResponse , $ assertionMap );
867
871
}
868
872
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
+
869
893
/**
870
894
* @param ProductInterface $product
871
895
* @param array $actualResponse
0 commit comments