Skip to content
Snippets Groups Projects
Commit a29406dc authored by Illia Grybkov's avatar Illia Grybkov
Browse files

MAGETWO-58174: When catalog is being indexed it should index in place or...

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
parent cc04f5ab
No related merge requests found
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
namespace Magento\CatalogSearch\Model\Indexer; namespace Magento\CatalogSearch\Model\Indexer;
use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product;
use Magento\CatalogSearch\Model\Indexer\Fulltext;
use Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection; use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection;
use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\Helper\Bootstrap;
...@@ -46,27 +48,27 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase ...@@ -46,27 +48,27 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase
protected $queryFactory; protected $queryFactory;
/** /**
* @var Product * @var \Magento\Catalog\Model\Product
*/ */
protected $productApple; protected $productApple;
/** /**
* @var Product * @var \Magento\Catalog\Model\Product
*/ */
protected $productBanana; protected $productBanana;
/** /**
* @var Product * @var \Magento\Catalog\Model\Product
*/ */
protected $productOrange; protected $productOrange;
/** /**
* @var Product * @var \Magento\Catalog\Model\Product
*/ */
protected $productPapaya; protected $productPapaya;
/** /**
* @var Product * @var \Magento\Catalog\Model\Product
*/ */
protected $productCherry; protected $productCherry;
...@@ -81,10 +83,10 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase ...@@ -81,10 +83,10 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase
$objectManager->configure( $objectManager->configure(
[ [
ltrim(\Magento\CatalogSearch\Model\Indexer\Fulltext::class, '\\') => [ ltrim(Fulltext::class, '\\') => [
'arguments' => [ 'arguments' => [
'indexSwitcher' => [ 'indexSwitcher' => [
'instance' => ltrim(\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class, '\\'), 'instance' => ltrim(IndexSwitcherMock::class, '\\'),
], ],
], ],
], ],
...@@ -115,7 +117,7 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase ...@@ -115,7 +117,7 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase
); );
$this->indexSwitcher = Bootstrap::getObjectManager()->get( $this->indexSwitcher = Bootstrap::getObjectManager()->get(
\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class IndexSwitcherMock::class
); );
$this->productApple = $this->getProductBySku('fulltext-1'); $this->productApple = $this->getProductBySku('fulltext-1');
...@@ -132,9 +134,9 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase ...@@ -132,9 +134,9 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase
{ {
$this->indexer->reindexAll(); $this->indexer->reindexAll();
/** @var \Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock $indexSwitcher */ /** @var IndexSwitcherMock $indexSwitcher */
$indexSwitcher = Bootstrap::getObjectManager()->get( $indexSwitcher = Bootstrap::getObjectManager()->get(
\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class IndexSwitcherMock::class
); );
$this->assertTrue($indexSwitcher->isSwitched()); $this->assertTrue($indexSwitcher->isSwitched());
} }
...@@ -146,9 +148,9 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase ...@@ -146,9 +148,9 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase
{ {
$this->indexer->reindexList([$this->productApple->getId(), $this->productBanana->getId()]); $this->indexer->reindexList([$this->productApple->getId(), $this->productBanana->getId()]);
/** @var \Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock $indexSwitcher */ /** @var IndexSwitcherMock $indexSwitcher */
$indexSwitcher = Bootstrap::getObjectManager()->get( $indexSwitcher = Bootstrap::getObjectManager()->get(
\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class IndexSwitcherMock::class
); );
$this->assertFalse($indexSwitcher->isSwitched()); $this->assertFalse($indexSwitcher->isSwitched());
} }
...@@ -160,9 +162,9 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase ...@@ -160,9 +162,9 @@ class SwitcherUsedInFulltextTest extends \PHPUnit_Framework_TestCase
{ {
$this->indexer->reindexRow($this->productPapaya->getId()); $this->indexer->reindexRow($this->productPapaya->getId());
/** @var \Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock $indexSwitcher */ /** @var IndexSwitcherMock $indexSwitcher */
$indexSwitcher = Bootstrap::getObjectManager()->get( $indexSwitcher = Bootstrap::getObjectManager()->get(
\Magento\CatalogSearch\Model\Indexer\IndexSwitcherMock::class IndexSwitcherMock::class
); );
$this->assertFalse($indexSwitcher->isSwitched()); $this->assertFalse($indexSwitcher->isSwitched());
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment