|
10 | 10 |
|
11 | 11 | use Magento\Catalog\Api\CategoryRepositoryInterface;
|
12 | 12 | use Magento\Catalog\Api\ProductRepositoryInterface;
|
| 13 | +use Magento\Catalog\Model\Product\Visibility; |
13 | 14 | use Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection as ProductAttributeCollection;
|
14 | 15 | use Magento\Catalog\Observer\SwitchPriceAttributeScopeOnConfigChange;
|
15 | 16 | use Magento\Catalog\Test\Fixture\Attribute as AttributeFixture;
|
@@ -747,6 +748,43 @@ public function testExportProductWithTwoWebsites(): void
|
747 | 748 | $switchPriceScope->execute($observer);
|
748 | 749 | }
|
749 | 750 |
|
| 751 | + /** |
| 752 | + * @magentoDataFixture Magento/Catalog/_files/product_simple.php |
| 753 | + * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php |
| 754 | + * @magentoDbIsolation disabled |
| 755 | + * @magentoAppArea adminhtml |
| 756 | + * |
| 757 | + * @return void |
| 758 | + */ |
| 759 | + public function testFilterForNonDefaultStore(): void |
| 760 | + { |
| 761 | + $secondStoreCode = 'fixture_second_store'; |
| 762 | + |
| 763 | + /** @var \Magento\Store\Model\Store $store */ |
| 764 | + $store = $this->objectManager->create(\Magento\Store\Model\Store::class); |
| 765 | + $secondStore = $store->load($secondStoreCode); |
| 766 | + |
| 767 | + /** @var \Magento\Catalog\Model\Product\Action $productAction */ |
| 768 | + $productAction = $this->objectManager->create(\Magento\Catalog\Model\Product\Action::class); |
| 769 | + |
| 770 | + $this->model->setWriter( |
| 771 | + $this->objectManager->create( |
| 772 | + \Magento\ImportExport\Model\Export\Adapter\Csv::class |
| 773 | + ) |
| 774 | + ); |
| 775 | + |
| 776 | + $product = $this->productRepository->get('simple'); |
| 777 | + $productId = $product->getId(); |
| 778 | + $productAction->updateWebsites([$productId], [$secondStore->getWebsiteId()], 'add'); |
| 779 | + $product->setStoreId($secondStore->getId()); |
| 780 | + $product->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE); |
| 781 | + $product->setName($product->getName() . ' ' . $secondStoreCode); |
| 782 | + $this->productRepository->save($product); |
| 783 | + |
| 784 | + $exportData = $this->doExport(['visibility' => Visibility::VISIBILITY_BOTH]); |
| 785 | + $this->assertStringNotContainsString($product->getName(), $exportData); |
| 786 | + } |
| 787 | + |
750 | 788 | /**
|
751 | 789 | * Verify that "stock status" filter correctly applies to export result
|
752 | 790 | *
|
|
0 commit comments