5
5
*/
6
6
namespace Magento \Signifyd \Block \Adminhtml ;
7
7
8
- use Magento \Backend \Block \Template ;
9
8
use Magento \Framework \App \RequestInterface ;
10
9
use Magento \Framework \ObjectManagerInterface ;
11
10
use Magento \Framework \View \Element \Template \Context ;
12
11
use Magento \Framework \View \LayoutInterface ;
13
12
use Magento \Sales \Model \Order ;
14
- use Magento \Sales \Model \OrderRepository ;
15
13
use Magento \TestFramework \Helper \Bootstrap ;
16
14
17
15
class CaseInfoTest extends \PHPUnit_Framework_TestCase
@@ -31,16 +29,6 @@ class CaseInfoTest extends \PHPUnit_Framework_TestCase
31
29
*/
32
30
private $ layout ;
33
31
34
- /**
35
- * @var string
36
- */
37
- private static $ submitButton = 'Submit Guarantee Request ' ;
38
-
39
- /**
40
- * @var string
41
- */
42
- private static $ cancelButton = 'Cancel Guarantee Request ' ;
43
-
44
32
/**
45
33
* @inheritdoc
46
34
*/
@@ -52,15 +40,18 @@ protected function setUp()
52
40
}
53
41
54
42
/**
55
- * Checks that block does not give contents
56
- * if Signifyd module is inactive.
43
+ * Checks that block has contents when case entity for order is exists
44
+ * even if Signifyd module is inactive.
57
45
*
58
46
* @magentoConfigFixture current_store fraud_protection/signifyd/active 0
47
+ * @magentoDataFixture Magento/Signifyd/_files/case.php
59
48
* @magentoAppArea adminhtml
60
49
*/
61
50
public function testModuleIsInactive ()
62
51
{
63
- static ::assertEmpty ($ this ->getBlockContents ());
52
+ $ this ->order ->loadByIncrementId ('100000001 ' );
53
+
54
+ static ::assertNotEmpty ($ this ->getBlockContents ());
64
55
}
65
56
66
57
/**
@@ -96,71 +87,8 @@ public function testCaseEntityExists()
96
87
97
88
$ html = $ this ->getBlockContents ();
98
89
static ::assertNotEmpty ($ html );
99
- static ::assertContains ('Some Team ' , $ html );
100
- static ::assertContains ('col-case-score-green ' , $ html );
101
- }
102
-
103
- /**
104
- * Checks state of Guarantee action buttons on order page.
105
- *
106
- * @covers \Magento\Signifyd\Block\Adminhtml\CaseInfo::getButtons
107
- * @magentoConfigFixture current_store fraud_protection/signifyd/active 1
108
- * @magentoDataFixture Magento/Signifyd/_files/case.php
109
- * @magentoAppArea adminhtml
110
- */
111
- public function testSubmitButtonAvailable ()
112
- {
113
- $ this ->order ->loadByIncrementId ('100000001 ' );
114
-
115
- $ blockContents = $ this ->getBlockContents ();
116
-
117
- static ::assertContains (self ::$ submitButton , $ blockContents );
118
- static ::assertNotContains (self ::$ cancelButton , $ blockContents );
119
- }
120
-
121
- /**
122
- * Checks that guarantee action buttons is unavailable on order page.
123
- *
124
- * @covers \Magento\Signifyd\Block\Adminhtml\CaseInfo::getButtons
125
- * @magentoConfigFixture current_store fraud_protection/signifyd/active 1
126
- * @magentoDataFixture Magento/Signifyd/_files/case.php
127
- * @magentoAppArea adminhtml
128
- */
129
- public function testButtonsUnavailable ()
130
- {
131
- $ this ->order ->loadByIncrementId ('100000001 ' );
132
- $ this ->order ->setState (Order::STATE_CANCELED );
133
-
134
- /** @var OrderRepository $orderRepository */
135
- $ orderRepository = $ this ->objectManager ->get (OrderRepository::class);
136
- $ orderRepository ->save ($ this ->order );
137
-
138
- $ blockContents = $ this ->getBlockContents ();
139
-
140
- static ::assertNotContains (self ::$ submitButton , $ blockContents );
141
- static ::assertNotContains (self ::$ cancelButton , $ blockContents );
142
- }
143
-
144
- /**
145
- * Checks action buttons for case entity with Guarantee submitted.
146
- *
147
- * @covers \Magento\Signifyd\Block\Adminhtml\CaseInfo::getButtons
148
- * @magentoConfigFixture current_store fraud_protection/signifyd/active 1
149
- * @magentoDataFixture Magento/Signifyd/_files/approved_case.php
150
- * @magentoAppArea adminhtml
151
- */
152
- public function testButtonsForApprovedCase ()
153
- {
154
- $ this ->order ->loadByIncrementId ('100000001 ' );
155
-
156
- /** @var OrderRepository $orderRepository */
157
- $ orderRepository = $ this ->objectManager ->get (OrderRepository::class);
158
- $ orderRepository ->save ($ this ->order );
159
-
160
- $ blockContents = $ this ->getBlockContents ();
161
-
162
- static ::assertNotContains (self ::$ submitButton , $ blockContents );
163
- static ::assertContains (self ::$ cancelButton , $ blockContents );
90
+ static ::assertContains ('Processing ' , $ html );
91
+ static ::assertContains ('Good ' , $ html );
164
92
}
165
93
166
94
/**
0 commit comments