Skip to content

Commit c650f17

Browse files
committed
MAGETWO-71398: Attribute values on store view level not searchable
- Add integration test;
1 parent 4c783cb commit c650f17

File tree

1 file changed

+55
-0
lines changed
  • dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action

1 file changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Action;
7+
8+
class DataProviderTest extends \PHPUnit_Framework_TestCase
9+
{
10+
/**
11+
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
12+
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php
13+
*/
14+
public function testRebuildStoreIndexConfigurable()
15+
{
16+
/** @var $objectManager \Magento\TestFramework\ObjectManager */
17+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
18+
$repository = $objectManager->create(
19+
\Magento\Catalog\Model\ProductRepository::class
20+
);
21+
/** @var \Magento\Store\Model\Store $store */
22+
$store = $objectManager->create(
23+
\Magento\Store\Model\Store::class
24+
);
25+
$globalStoreId = $store->load('admin')->getId();
26+
$secondStoreId = $store->load('fixture_second_store')->getId();
27+
$thirdStoreId = $store->load('fixture_third_store')->getId();
28+
/** @var \Magento\Catalog\Model\Product\Action $productAction */
29+
$productAction = $objectManager->create(
30+
\Magento\Catalog\Model\Product\Action::class
31+
);
32+
33+
$product = $repository->get('simple');
34+
$productId = $product->getId();
35+
$productResource = $product->getResource();
36+
$productAction->updateWebsites([$productId], [$store->load('fixture_second_store')->getWebsiteId()], 'add');
37+
$product->setOrigData();
38+
$product->setStoreId($secondStoreId);
39+
$product->setShortDescription('short description 2 store');
40+
$productResource->save($product);
41+
42+
$this->assertEquals(
43+
'Short description',
44+
$productResource->getAttributeRawValue($productId, 'short_description', $globalStoreId)
45+
);
46+
$this->assertEquals(
47+
'short description 2 store',
48+
$productResource->getAttributeRawValue($productId, 'short_description', $secondStoreId)
49+
);
50+
$this->assertEquals(
51+
'Short description',
52+
$productResource->getAttributeRawValue($productId, 'short_description', $thirdStoreId)
53+
);
54+
}
55+
}

0 commit comments

Comments
 (0)