Skip to content

Commit b5e761b

Browse files
committed
MAGETWO-94070: [2.3.x] Enable/disable EAV indexer from configuration
- Add comment blocks to tests;
1 parent d1021a3 commit b5e761b

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class AbstractActionTest extends \PHPUnit\Framework\TestCase
2727
*/
2828
private $scopeConfig;
2929

30+
/**
31+
* @return void
32+
*/
3033
protected function setUp()
3134
{
3235
$this->_eavDecimalFactoryMock = $this->createPartialMock(
@@ -50,6 +53,9 @@ protected function setUp()
5053
);
5154
}
5255

56+
/**
57+
* @return void
58+
*/
5359
public function testGetIndexers()
5460
{
5561
$expectedIndexers = [
@@ -85,6 +91,10 @@ public function testGetIndexerWithUnknownTypeThrowsException()
8591
$this->_model->getIndexer('unknown_type');
8692
}
8793

94+
/**
95+
* @return void
96+
* @throws \Magento\Framework\Exception\LocalizedException
97+
*/
8898
public function testGetIndexer()
8999
{
90100
$this->_eavSourceFactoryMock->expects($this->once())
@@ -98,6 +108,10 @@ public function testGetIndexer()
98108
$this->assertEquals('source_return_value', $this->_model->getIndexer('source'));
99109
}
100110

111+
/**
112+
* @return void
113+
* @throws \Exception
114+
*/
101115
public function testReindexWithoutArgumentsExecutesReindexAll()
102116
{
103117
$eavSource = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\Source::class)
@@ -197,6 +211,10 @@ public function testReindexWithNotNullArgumentExecutesReindexEntities(
197211
$this->_model->reindex($ids);
198212
}
199213

214+
/**
215+
* @return void
216+
* @throws \Exception
217+
*/
200218
public function testReindexWithDisabledEavIndexer()
201219
{
202220
$this->scopeConfig->expects($this->once())->method('getValue')->willReturn(0);

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/Action/FullTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class FullTest extends \PHPUnit\Framework\TestCase
5858
*/
5959
private $scopeConfig;
6060

61+
/**
62+
* @return void
63+
*/
6164
protected function setUp()
6265
{
6366
$this->eavDecimalFactory = $this->createPartialMock(DecimalFactory::class, ['create']);
@@ -148,6 +151,10 @@ public function testExecute()
148151
$this->model->execute();
149152
}
150153

154+
/**
155+
* @return void
156+
* @throws \Magento\Framework\Exception\LocalizedException
157+
*/
151158
public function testExecuteWithDisabledEavIndexer()
152159
{
153160
$this->scopeConfig->expects($this->once())->method('getValue')->willReturn(0);

app/code/Magento/CatalogSearch/Test/Unit/Plugin/EnableEavIndexerTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ protected function setUp()
3939
);
4040
}
4141

42+
/**
43+
* Test with other search engine (not MySQL) selected in config
44+
*
45+
* @return void
46+
*/
4247
public function testBeforeSave()
4348
{
4449
$this->config->expects($this->once())->method('getData')->willReturn('elasticsearch');
@@ -47,6 +52,11 @@ public function testBeforeSave()
4752
$this->model->beforeSave($this->config);
4853
}
4954

55+
/**
56+
* Test with MySQL search engine selected in config
57+
*
58+
* @return void
59+
*/
5060
public function testBeforeSaveMysqlSearchEngine()
5161
{
5262
$this->config->expects($this->at(0))->method('getData')->willReturn('mysql');

0 commit comments

Comments
 (0)