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
module-sales-rule
Test
Unit
Model
Plugin
QuoteConfigProductAttributesTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\SalesRule\Test\Unit\Model\Plugin
;
8
9
class
QuoteConfigProductAttributesTest
extends
\PHPUnit\Framework\TestCase
10
{
14
protected
$plugin
;
15
19
protected
$ruleResource
;
20
21
protected
function
setUp
()
22
{
23
$objectManager
= new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
24
$this->ruleResource = $this->createMock(\
Magento
\SalesRule\Model\
ResourceModel
\Rule::class);
25
26
$this->plugin =
$objectManager
->getObject(
27
\
Magento
\SalesRule\Model\Plugin\QuoteConfigProductAttributes::class,
28
[
29
'ruleResource'
=> $this->ruleResource
30
]
31
);
32
}
33
34
public
function
testAfterGetProductAttributes
()
35
{
36
$subject = $this->createMock(\
Magento
\Quote\Model\Quote\Config::class);
37
$attributeCode
=
'code of the attribute'
;
38
$expected = [0 =>
$attributeCode
];
39
40
$this->ruleResource->expects($this->once())
41
->method(
'getActiveAttributes'
)
42
->will(
43
$this->returnValue(
44
[
45
[
'attribute_code'
=>
$attributeCode
,
'enabled'
=>
true
],
46
]
47
)
48
);
49
50
$this->assertEquals($expected, $this->plugin->afterGetProductAttributes($subject, []));
51
}
52
}
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
$objectManager
$objectManager
Definition:
bootstrap.php:17
Magento\SalesRule\Test\Unit\Model\Plugin\QuoteConfigProductAttributesTest
Definition:
QuoteConfigProductAttributesTest.php:9
Magento\SalesRule\Test\Unit\Model\Plugin\QuoteConfigProductAttributesTest\$plugin
$plugin
Definition:
QuoteConfigProductAttributesTest.php:14
Magento\SalesRule\Test\Unit\Model\Plugin\QuoteConfigProductAttributesTest\setUp
setUp()
Definition:
QuoteConfigProductAttributesTest.php:21
Magento\SalesRule\Test\Unit\Model\Plugin\QuoteConfigProductAttributesTest\testAfterGetProductAttributes
testAfterGetProductAttributes()
Definition:
QuoteConfigProductAttributesTest.php:34
Magento\SalesRule\Test\Unit\Model\Plugin\QuoteConfigProductAttributesTest\$ruleResource
$ruleResource
Definition:
QuoteConfigProductAttributesTest.php:19
Magento\SalesRule\Test\Unit\Model\Plugin
Definition:
QuoteConfigProductAttributesTest.php:7
$attributeCode
$attributeCode
Definition:
extend.phtml:12
Magento