1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
namespace Vertex\Tax\Test\Unit\Model\Plugin;
use Magento\Config\Model\Config\Structure\Element\Group;
use Vertex\Tax\Model\ModuleManager;
use Vertex\Tax\Model\Plugin\GroupPlugin;
use Vertex\Tax\Test\Unit\TestCase;
class GroupPluginTest extends TestCase
{
/** @var \PHPUnit_Framework_MockObject_MockObject|GroupPlugin */
private $plugin;
/** @var \PHPUnit_Framework_MockObject_MockObject|ModuleManager */
private $moduleManager;
protected function setUp()
{
parent::setUp();
$this->moduleManager = $this->createPartialMock(ModuleManager::class, ['isEnabled']);
$this->plugin = $this->getObject(GroupPlugin::class, ['moduleManager' => $this->moduleManager]);
}
public function testAroundSetData()
{
/** @var \PHPUnit_Framework_MockObject_MockObject|Group $subject */
$subject = $this->createMock(Group::class);
$data = [
'path' => 'tax',
'id' => 'classes',
'children' => [
'giftwrap_order_class' => [
'showInDefault' => 1,
'showInWebsite' => 1,
'showInStore' => 1
],
'giftwrap_order_code' => [
'showInDefault' => 1,
'showInWebsite' => 1,
'showInStore' => 1
],
'giftwrap_item_class' => [
'showInDefault' => 1,
'showInWebsite' => 1,
'showInStore' => 1
],
'giftwrap_item_code' => [
'showInDefault' => 1,
'showInWebsite' => 1,
'showInStore' => 1
],
'printed_giftcard_class' => [
'showInDefault' => 1,
'showInWebsite' => 1,
'showInStore' => 1
],
'printed_giftcard_code' => [
'showInDefault' => 1,
'showInWebsite' => 1,
'showInStore' => 1
],
'reward_points_class' => [
'showInDefault' => 1,
'showInWebsite' => 1,
'showInStore' => 1
],
'reward_points_code' => [
'showInDefault' => 1,
'showInWebsite' => 1,
'showInStore' => 1
]
]
];
$scope = 'default';
$proceed = function () use ($scope) {
return $scope;
};
$this->moduleManager->method('isEnabled')
->with($this->logicalOr('Magento_GiftWrapping', 'Magento_Reward'))
->willReturn(false);
$this->plugin->aroundSetData($subject, $proceed, $data, $scope);
}
}