7
7
8
8
use Magento \Framework \Message \MessageInterface ;
9
9
use Magento \TestFramework \Helper \Bootstrap ;
10
+ use Magento \Framework \Data \Form \FormKey ;
10
11
11
12
/**
12
13
* @magentoAppArea adminhtml
@@ -80,6 +81,11 @@ public function testNewActionWithCustomerGroupDataInSession()
80
81
*/
81
82
public function testDeleteActionNoGroupId ()
82
83
{
84
+ /** @var FormKey $formKey */
85
+ $ formKey = $ this ->_objectManager ->get (FormKey::class);
86
+
87
+ $ this ->getRequest ()->setMethod ('POST ' );
88
+ $ this ->getRequest ()->setParam ('form_key ' , $ formKey ->getFormKey ());
83
89
$ this ->dispatch ('backend/customer/group/delete ' );
84
90
$ this ->assertRedirect ($ this ->stringStartsWith (self ::BASE_CONTROLLER_URL ));
85
91
}
@@ -90,7 +96,17 @@ public function testDeleteActionNoGroupId()
90
96
public function testDeleteActionExistingGroup ()
91
97
{
92
98
$ groupId = $ this ->findGroupIdWithCode (self ::CUSTOMER_GROUP_CODE );
93
- $ this ->getRequest ()->setParam ('id ' , $ groupId );
99
+
100
+ /** @var FormKey $formKey */
101
+ $ formKey = $ this ->_objectManager ->get (FormKey::class);
102
+
103
+ $ this ->getRequest ()->setMethod ('POST ' );
104
+ $ this ->getRequest ()->setParams (
105
+ [
106
+ 'id ' => $ groupId ,
107
+ 'form_key ' => $ formKey ->getFormKey ()
108
+ ]
109
+ );
94
110
$ this ->dispatch ('backend/customer/group/delete ' );
95
111
96
112
/**
@@ -108,7 +124,16 @@ public function testDeleteActionExistingGroup()
108
124
*/
109
125
public function testDeleteActionNonExistingGroupId ()
110
126
{
111
- $ this ->getRequest ()->setParam ('id ' , 10000 );
127
+ /** @var FormKey $formKey */
128
+ $ formKey = $ this ->_objectManager ->get (FormKey::class);
129
+
130
+ $ this ->getRequest ()->setMethod ('POST ' );
131
+ $ this ->getRequest ()->setParams (
132
+ [
133
+ 'id ' => 10000 ,
134
+ 'form_key ' => $ formKey ->getFormKey ()
135
+ ]
136
+ );
112
137
$ this ->dispatch ('backend/customer/group/delete ' );
113
138
114
139
/**
0 commit comments