Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
CatalogRule
Model
Indexer
RuleProductTest.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\CatalogRule\Model\Indexer
;
7
8
use
Magento\TestFramework\Helper\Bootstrap
;
9
14
class
RuleProductTest
extends
\PHPUnit\Framework\TestCase
15
{
19
protected
$indexBuilder
;
20
24
protected
$resourceRule
;
25
26
protected
function
setUp
()
27
{
28
$this->indexBuilder =
Bootstrap::getObjectManager
()->get(
29
\
Magento
\CatalogRule\Model\Indexer\IndexBuilder::class
30
);
31
$this->resourceRule =
Bootstrap::getObjectManager
()->get(\
Magento
\CatalogRule\Model\
ResourceModel
\Rule::class);
32
}
33
40
public
function
testReindexAfterRuleCreation()
41
{
43
$productRepository
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->get(
44
\
Magento
\Catalog\Model\ProductRepository::class
45
);
46
$product
=
$productRepository
->get(
'simple'
);
47
$product
->setData(
'test_attribute'
,
'test_attribute_value'
)->save();
48
$this->assertFalse($this->resourceRule->getRulePrice(
new
\
DateTime
(), 1, 1,
$product
->getId()));
49
50
// apply all rules
51
$this->indexBuilder->reindexFull();
52
53
$this->assertEquals(9.8, $this->resourceRule->getRulePrice(
new
\
DateTime
(), 1, 1,
$product
->getId()));
54
}
55
}
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
Magento\CatalogRule\Model\Indexer\RuleProductTest\setUp
setUp()
Definition:
RuleProductTest.php:26
Magento\Framework\Stdlib\DateTime\DateTime
Definition:
DateTime.php:15
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
Magento\CatalogRule\Model\Indexer\RuleProductTest\$resourceRule
$resourceRule
Definition:
RuleProductTest.php:24
Magento\CatalogRule\Model\Indexer
Definition:
BatchIndexTest.php:7
Magento\CatalogRule\Model\Indexer\RuleProductTest
Definition:
RuleProductTest.php:14
$productRepository
$productRepository
Definition:
bundle_product_with_not_visible_children.php:18
Magento
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\CatalogRule\Model\Indexer\RuleProductTest\$indexBuilder
$indexBuilder
Definition:
RuleProductTest.php:19
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125