@@ -31,6 +31,16 @@ class CaseInfoTest extends \PHPUnit_Framework_TestCase
31
31
*/
32
32
private $ layout ;
33
33
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
+
34
44
/**
35
45
* @inheritdoc
36
46
*/
@@ -91,18 +101,21 @@ public function testCaseEntityExists()
91
101
}
92
102
93
103
/**
94
- * Checks that guarantee action buttons is available on order page.
104
+ * Checks state of Guarantee action buttons on order page.
95
105
*
96
106
* @covers \Magento\Signifyd\Block\Adminhtml\CaseInfo::getButtons
97
107
* @magentoConfigFixture current_store fraud_protection/signifyd/active 1
98
108
* @magentoDataFixture Magento/Signifyd/_files/case.php
99
109
* @magentoAppArea adminhtml
100
110
*/
101
- public function testButtonsAvailable ()
111
+ public function testSubmitButtonAvailable ()
102
112
{
103
113
$ this ->order ->loadByIncrementId ('100000001 ' );
104
114
105
- static ::assertContains ('Submit Guarantee Request ' , $ this ->getBlockContents ());
115
+ $ blockContents = $ this ->getBlockContents ();
116
+
117
+ static ::assertContains (self ::$ submitButton , $ blockContents );
118
+ static ::assertNotContains (self ::$ cancelButton , $ blockContents );
106
119
}
107
120
108
121
/**
@@ -122,7 +135,32 @@ public function testButtonsUnavailable()
122
135
$ orderRepository = $ this ->objectManager ->get (OrderRepository::class);
123
136
$ orderRepository ->save ($ this ->order );
124
137
125
- static ::assertNotContains ('Submit Guarantee request ' , $ this ->getBlockContents ());
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 );
126
164
}
127
165
128
166
/**
0 commit comments