Skip to content

Commit ce9cfa4

Browse files
committed
MAGETWO-92402: Write tests
1 parent db32815 commit ce9cfa4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

dev/tests/integration/framework/Magento/TestFramework/Annotation/IndexerDimensionMode.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,28 @@ class IndexerDimensionMode
3232
public function __construct(Application $application)
3333
{
3434
$this->db = $application->getDbInstance();
35-
$this->objectManager = Bootstrap::getObjectManager();
36-
$this->modeSwithcer = $this->objectManager->get(ModeSwitcher::class);
37-
$this->configWriter = $this->objectManager->get(ConfigInterface::class);
3835
}
3936

4037
private function restoreDb()
4138
{
4239
$this->db->restoreFromDbDump();
4340
}
4441

42+
private function initSwicher()
43+
{
44+
if (!$this->modeSwithcer) {
45+
$this->objectManager = Bootstrap::getObjectManager();
46+
$this->modeSwithcer = $this->objectManager->get(ModeSwitcher::class);
47+
$this->configWriter = $this->objectManager->get(ConfigInterface::class);
48+
}
49+
}
50+
4551
/**
4652
* @param string $mode
4753
*/
4854
private function setDimensionMode($mode = DimensionModeConfiguration::DIMENSION_WEBSITE_AND_CUSTOMER_GROUP)
4955
{
56+
$this->initSwicher();
5057
$this->modeSwithcer->createTables($mode);
5158
$this->modeSwithcer->moveData($mode, DimensionModeConfiguration::DIMENSION_NONE);
5259
$this->configWriter->saveConfig(ModeSwitcher::XML_PATH_PRICE_DIMENSIONS_MODE, $mode);

0 commit comments

Comments
 (0)