Skip to content

Commit 2504ba3

Browse files
committed
Merge remote-tracking branch 'origin/BUG#AC-2535' into Hammer_Quality_Backlog_GraphQl_13042022
2 parents ee47c6f + 861cb3b commit 2504ba3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

app/code/Magento/CatalogUrlRewrite/Model/Products/AdaptUrlRewritesToVisibilityAttribute.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public function execute(array $productIds, int $visibility, int $storeId): void
7979
[
8080
UrlRewrite::ENTITY_ID => $product->getId(),
8181
UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
82+
UrlRewrite::STORE_ID => $storeId,
8283
]
8384
);
8485
} elseif ($visibility !== Visibility::VISIBILITY_NOT_VISIBLE) {

dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Observer/ProcessUrlRewriteOnChangeVisibilityObserverTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ public function testMakeProductInvisibleViaMassAction()
6767

6868
/** @var StoreManagerInterface $storeManager */
6969
$storeManager = $this->objectManager->get(StoreManagerInterface::class);
70-
$storeManager->setCurrentStore(0);
71-
70+
$firstStore = current($product->getStoreIds());
7271
$testStore = $storeManager->getStore('test');
7372
$productFilter = [
7473
UrlRewrite::ENTITY_TYPE => 'product',
@@ -80,7 +79,7 @@ public function testMakeProductInvisibleViaMassAction()
8079
'target_path' => "catalog/product/view/id/" . $product->getId(),
8180
'is_auto_generated' => 1,
8281
'redirect_type' => 0,
83-
'store_id' => '1',
82+
'store_id' => $firstStore,
8483
],
8584
[
8685
'request_path' => "product-1.html",
@@ -100,12 +99,14 @@ public function testMakeProductInvisibleViaMassAction()
10099
'catalog_product_attribute_update_before',
101100
[
102101
'attributes_data' => [ ProductInterface::VISIBILITY => Visibility::VISIBILITY_NOT_VISIBLE ],
103-
'product_ids' => [$product->getId()]
102+
'product_ids' => [$product->getId()],
103+
'store_id' => $firstStore,
104104
]
105105
);
106106

107107
$actual = $this->getActualResults($productFilter);
108-
$this->assertCount(0, $actual);
108+
//Initially count was 2, when visibility of 1 store view is set to not visible individually, the new count is 1
109+
$this->assertCount(1, $actual);
109110
}
110111

111112
/**

0 commit comments

Comments
 (0)