Skip to content

Commit 46450bf

Browse files
authored
ENGCOM-7722: #28580: False positive behavior of testQueryCustomAtt… #28743
2 parents 2997c27 + 60335a5 commit 46450bf

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,8 @@ private function assertMediaGalleryEntries($product, $actualResponse)
665665
{
666666
$mediaGalleryEntries = $product->getMediaGalleryEntries();
667667
$this->assertCount(1, $mediaGalleryEntries, "Precondition failed, incorrect number of media gallery entries.");
668-
$this->assertIsArray([$actualResponse['media_gallery_entries']],
668+
$this->assertIsArray(
669+
[$actualResponse['media_gallery_entries']],
669670
"Media galleries field must be of an array type."
670671
);
671672
$this->assertCount(1, $actualResponse['media_gallery_entries'], "There must be 1 record in media gallery.");
@@ -701,10 +702,10 @@ private function assertMediaGalleryEntries($product, $actualResponse)
701702
*/
702703
private function assertCustomAttribute($actualResponse)
703704
{
704-
$customAttribute = null;
705+
$customAttribute = 'customAttributeValue';
705706
$this->assertEquals($customAttribute, $actualResponse['attribute_code_custom']);
706707
}
707-
708+
708709
/**
709710
* @param ProductInterface $product
710711
* @param $actualResponse

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_custom_attribute.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
$entityTypeId = $entityModel->setType(\Magento\Catalog\Model\Product::ENTITY)->getTypeId();
2121
$groupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
2222

23+
/** @var \Magento\Catalog\Model\Product $product */
24+
$product = $productRepository->get('simple', true);
25+
2326
/** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
2427
$attribute = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class);
2528
$attribute->setAttributeCode(
@@ -30,6 +33,8 @@
3033
'text'
3134
)->setFrontendLabel(
3235
'custom_attributes_frontend_label'
36+
)->setAttributeSetId(
37+
$product->getDefaultAttributeSetId()
3338
)->setAttributeGroupId(
3439
$groupId
3540
)->setIsFilterable(
@@ -40,8 +45,6 @@
4045
$attribute->getBackendTypeByInput($attribute->getFrontendInput())
4146
)->save();
4247

43-
$product = $productRepository->get('simple', true);
44-
4548
$product->setCustomAttribute($attribute->getAttributeCode(), 'customAttributeValue');
4649

4750
$productRepository->save($product);

0 commit comments

Comments
 (0)