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-checkout
Test
Unit
Block
Cart
CartTotalsProcessorTest.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Checkout\Test\Unit\Block\Cart
;
7
8
class
CartTotalsProcessorTest
extends
\PHPUnit\Framework\TestCase
9
{
13
protected
$model
;
14
18
protected
$scopeConfig
;
19
20
protected
function
setUp
()
21
{
22
$this->scopeConfig = $this->createMock(\
Magento
\Framework\
App
\Config\ScopeConfigInterface::class);
23
$this->model = new \Magento\Checkout\Block\Cart\CartTotalsProcessor($this->scopeConfig);
24
}
25
26
public
function
testProcess
()
27
{
28
$configData
= [
29
'total_1'
=>
'sort_1'
,
30
'total_2'
=>
'sort_2'
,
31
'total_3'
=>
'sort_3'
32
];
33
34
$jsLayout = [
35
'components'
=> [
36
'block-totals'
=> [
37
'children'
=> [
38
'total_1'
=> [
'value'
=>
'value_1'
,
'sortOrder'
=> 0],
39
'total_2'
=> [
'value'
=>
'value_1'
,
'sortOrder'
=> 1],
40
'total_3'
=> [
'value'
=>
'value_1'
,
'sortOrder'
=> 2]
41
]
42
]
43
]
44
];
45
46
$expected = [
47
'components'
=> [
48
'block-totals'
=> [
49
'children'
=> [
50
'total_1'
=> [
'value'
=>
'value_1'
,
'sortOrder'
=>
'sort_1'
],
51
'total_2'
=> [
'value'
=>
'value_1'
,
'sortOrder'
=>
'sort_2'
],
52
'total_3'
=> [
'value'
=>
'value_1'
,
'sortOrder'
=>
'sort_3'
]
53
]
54
]
55
]
56
];
57
58
$this->scopeConfig->expects($this->once())
59
->method(
'getValue'
)
60
->with(
'sales/totals_sort'
)
61
->willReturn(
$configData
);
62
63
$this->assertEquals($expected, $this->model->process($jsLayout));
64
}
65
}
Magento\Framework\App
Magento\Checkout\Test\Unit\Block\Cart
Definition:
AbstractCartTest.php:6
Magento\Checkout\Test\Unit\Block\Cart\CartTotalsProcessorTest\testProcess
testProcess()
Definition:
CartTotalsProcessorTest.php:26
Magento\Checkout\Test\Unit\Block\Cart\CartTotalsProcessorTest
Definition:
CartTotalsProcessorTest.php:8
Magento\Checkout\Test\Unit\Block\Cart\CartTotalsProcessorTest\$scopeConfig
$scopeConfig
Definition:
CartTotalsProcessorTest.php:18
$configData
$configData
Definition:
payment_configuration.php:26
Magento
Magento\Checkout\Test\Unit\Block\Cart\CartTotalsProcessorTest\setUp
setUp()
Definition:
CartTotalsProcessorTest.php:20
Magento\Checkout\Test\Unit\Block\Cart\CartTotalsProcessorTest\$model
$model
Definition:
CartTotalsProcessorTest.php:13