Skip to content

Commit a29406d

Browse files
committed
MAGETWO-58174: When catalog is being indexed it should index in place or leverage an index alias so store can still function during a long index run
- Fix coupling between objects in test class
1 parent cc04f5a commit a29406d

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/SwitcherUsedInFulltextTest.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\CatalogSearch\Model\Indexer;
77

88
use Magento\Catalog\Model\Product;
9+
use Magento\CatalogSearch\Model\Indexer\Fulltext;
10+
use Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock;
911
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection;
1012
use Magento\TestFramework\Helper\Bootstrap;
1113

@@ -46,27 +48,27 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase
4648
protected $queryFactory;
4749

4850
/**
49-
* @var Product
51+
* @var \Magento\Catalog\Model\Product
5052
*/
5153
protected $productApple;
5254

5355
/**
54-
* @var Product
56+
* @var \Magento\Catalog\Model\Product
5557
*/
5658
protected $productBanana;
5759

5860
/**
59-
* @var Product
61+
* @var \Magento\Catalog\Model\Product
6062
*/
6163
protected $productOrange;
6264

6365
/**
64-
* @var Product
66+
* @var \Magento\Catalog\Model\Product
6567
*/
6668
protected $productPapaya;
6769

6870
/**
69-
* @var Product
71+
* @var \Magento\Catalog\Model\Product
7072
*/
7173
protected $productCherry;
7274

@@ -81,10 +83,10 @@ protected function setUp()
8183

8284
$objectManager->configure(
8385
[
84-
ltrim(\Magento\CatalogSearch\Model\Indexer\Fulltext::class, '\\') => [
86+
ltrim(Fulltext::class, '\\') => [
8587
'arguments' => [
8688
'indexSwitcher' => [
87-
'instance' => ltrim(\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class, '\\'),
89+
'instance' => ltrim(IndexSwitcherMock::class, '\\'),
8890
],
8991
],
9092
],
@@ -115,7 +117,7 @@ protected function setUp()
115117
);
116118

117119
$this->indexSwitcher = Bootstrap::getObjectManager()->get(
118-
\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class
120+
IndexSwitcherMock::class
119121
);
120122

121123
$this->productApple = $this->getProductBySku('fulltext-1');
@@ -132,9 +134,9 @@ public function testReindexAll()
132134
{
133135
$this->indexer->reindexAll();
134136

135-
/** @var \Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock $indexSwitcher */
137+
/** @var IndexSwitcherMock $indexSwitcher */
136138
$indexSwitcher = Bootstrap::getObjectManager()->get(
137-
\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class
139+
IndexSwitcherMock::class
138140
);
139141
$this->assertTrue($indexSwitcher->isSwitched());
140142
}
@@ -146,9 +148,9 @@ public function testReindexList()
146148
{
147149
$this->indexer->reindexList([$this->productApple->getId(), $this->productBanana->getId()]);
148150

149-
/** @var \Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock $indexSwitcher */
151+
/** @var IndexSwitcherMock $indexSwitcher */
150152
$indexSwitcher = Bootstrap::getObjectManager()->get(
151-
\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class
153+
IndexSwitcherMock::class
152154
);
153155
$this->assertFalse($indexSwitcher->isSwitched());
154156
}
@@ -160,9 +162,9 @@ public function testReindexRow()
160162
{
161163
$this->indexer->reindexRow($this->productPapaya->getId());
162164

163-
/** @var \Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock $indexSwitcher */
165+
/** @var IndexSwitcherMock $indexSwitcher */
164166
$indexSwitcher = Bootstrap::getObjectManager()->get(
165-
\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class
167+
IndexSwitcherMock::class
166168
);
167169
$this->assertFalse($indexSwitcher->isSwitched());
168170
}

0 commit comments

Comments
 (0)