Skip to content

Commit cf4e799

Browse files
committed
MAGETWO-92402: Write tests
1 parent dc7207b commit cf4e799

File tree

9 files changed

+29
-25
lines changed

9 files changed

+29
-25
lines changed

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

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
namespace Magento\TestFramework\Annotation;
88

99
use Magento\Catalog\Model\Indexer\Product\Price\ModeSwitcher;
10+
use Magento\Catalog\Model\Indexer\Product\Price\Processor;
1011
use Magento\Framework\App\Cache\TypeListInterface;
1112
use Magento\Framework\App\Config\ConfigResource\ConfigInterface;
1213
use Magento\Framework\App\Config\ScopeConfigInterface;
13-
use Magento\TestFramework\Application;
14+
use Magento\Framework\ObjectManagerInterface;
1415
use Magento\TestFramework\App\Config;
1516
use Magento\TestFramework\Helper\Bootstrap;
1617
use Magento\Catalog\Model\Indexer\Product\Price\DimensionModeConfiguration;
@@ -21,29 +22,30 @@
2122
*/
2223
class IndexerDimensionMode
2324
{
24-
protected $cacheTypeList;
25+
/** @var TypeListInterface */
26+
private $cacheTypeList;
27+
28+
/** @var ScopeConfigInterface */
2529
private $configReader;
2630

31+
/** @var ModeSwitcher */
2732
private $modeSwitcher;
2833

34+
/** @var ConfigInterface */
2935
private $configWriter;
3036

37+
/** @var ObjectManagerInterface */
38+
private $objectManager;
39+
40+
/** @var \Magento\TestFramework\Db\Mysql */
3141
private $db;
3242

43+
/** @var bool */
3344
private $isDimensionMode = false;
3445

35-
private $objectManager;
36-
37-
public function __construct(Application $application)
38-
{
39-
$this->db = $application->getDbInstance();
40-
}
41-
4246
private function restoreDb()
4347
{
44-
$this->db = Bootstrap::getInstance()->getBootstrap()
45-
->getApplication()
46-
->getDbInstance();
48+
$this->db = Bootstrap::getInstance()->getBootstrap()->getApplication()->getDbInstance();
4749
$this->db->restoreFromDbDump();
4850
$this->cacheTypeList->cleanType('config');
4951
$this->objectManager->get(Config::class)->clean();
@@ -87,10 +89,9 @@ private function setDimensionMode($mode, $test)
8789
} else {
8890
$this->fail('Dimensions mode for indexer has not been changed', $test);
8991
}
90-
9192
}
9293

93-
/**
94+
/**
9495
* Handler for 'startTest' event
9596
*
9697
* @param TestCase $test
@@ -108,12 +109,15 @@ public function startTest(TestCase $test)
108109
return;
109110
}
110111

111-
$dbIsolation = $source['method']['magentoDbIsolation'] ?? $source['class']['magentoDbIsolation'] ?? ['disabled'];
112+
$dbIsolation = $source['method']['magentoDbIsolation']
113+
?? $source['class']['magentoDbIsolation']
114+
?? ['disabled'];
115+
112116
if ($dbIsolation[0] != 'disabled') {
113117
$this->fail("Invalid @magentoDbIsolation declaration: $dbIsolation[0]", $test);
114118
}
115119

116-
if ($annotations[0] == 'price') {
120+
if ($annotations[0] == Processor::INDEXER_ID) {
117121
$this->isDimensionMode = true;
118122
$this->setDimensionMode(DimensionModeConfiguration::DIMENSION_WEBSITE_AND_CUSTOMER_GROUP, $test);
119123
}

dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorWithDimensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* @magentoDbIsolation disabled
11-
* @magentoIndexerDimensionMode price
11+
* @magentoIndexerDimensionMode catalog_product_price website_and_customer_group
1212
* @group indexer_dimension
1313
* @magentoAppArea frontend
1414
*/

dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorWithDimensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/**
1212
* @magentoDbIsolation disabled
13-
* @magentoIndexerDimensionMode price
13+
* @magentoIndexerDimensionMode catalog_product_price website_and_customer_group
1414
* @group indexer_dimension
1515
* @magentoAppArea frontend
1616
*/

dev/tests/integration/testsuite/Magento/Bundle/Model/Product/PriceWithDimensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
/**
99
* @magentoDbIsolation disabled
10-
* @magentoIndexerDimensionMode price
10+
* @magentoIndexerDimensionMode catalog_product_price website_and_customer_group
1111
* @group indexer_dimension
1212
* @magentoDataFixture Magento/Bundle/_files/product_with_tier_pricing.php
1313
*/

dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Price/SimpleWithOptionsTierPriceWithDimensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function setUp()
4242

4343
/**
4444
* @magentoDbIsolation disabled
45-
* @magentoIndexerDimensionMode price
45+
* @magentoIndexerDimensionMode catalog_product_price website_and_customer_group
4646
* @magentoDataFixture Magento/Catalog/_files/category_product.php
4747
*/
4848
public function testTierPrice()

dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceWithDimensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/**
1111
* @magentoDbIsolation disabled
12-
* @magentoIndexerDimensionMode price
12+
* @magentoIndexerDimensionMode catalog_product_price website_and_customer_group
1313
* @group indexer_dimension
1414
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
1515
*/

dev/tests/integration/testsuite/Magento/Catalog/Model/ProductPriceWithDimensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testSetGetFinalPrice()
8383

8484
/**
8585
* @magentoDbIsolation disabled
86-
* @magentoIndexerDimensionMode price
86+
* @magentoIndexerDimensionMode catalog_product_price website_and_customer_group
8787
* @magentoDataFixture Magento/Catalog/_files/product_with_options.php
8888
*/
8989
public function testGetMinPrice()
@@ -100,7 +100,7 @@ public function testGetMinPrice()
100100

101101
/**
102102
* @magentoDbIsolation disabled
103-
* @magentoIndexerDimensionMode price
103+
* @magentoIndexerDimensionMode catalog_product_price website_and_customer_group
104104
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php
105105
*/
106106
public function testGetMinPriceForComposite()

dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/SpecialPriceIndexerWithDimensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @magentoDbIsolation disabled
1818
* @group indexer_dimension
19-
* @magentoIndexerDimensionMode price
19+
* @magentoIndexerDimensionMode catalog_product_price website_and_customer_group
2020
*/
2121
class SpecialPriceIndexerWithDimensionTest extends \PHPUnit\Framework\TestCase
2222
{

dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Render/FinalPriceBox/RenderingBasedOnIsProductListFlagWithDimensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/**
1818
* @magentoDbIsolation disabled
19-
* @magentoIndexerDimensionMode price
19+
* @magentoIndexerDimensionMode catalog_product_price website_and_customer_group
2020
* @group indexer_dimension
2121
* Test price rendering according to is_product_list flag for Configurable product
2222
*/

0 commit comments

Comments
 (0)