File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute
dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 8
8
namespace Magento \Catalog \Controller \Adminhtml \Product \Attribute ;
9
9
10
10
use Magento \Catalog \Model \Product \Attribute \Option \OptionsDataSerializer ;
11
+ use Magento \Framework \App \Action \HttpGetActionInterface ;
12
+ use Magento \Framework \App \Action \HttpPostActionInterface as HttpPostActionInterface ;
11
13
use Magento \Framework \App \ObjectManager ;
12
14
use Magento \Framework \DataObject ;
15
+ use Magento \Catalog \Controller \Adminhtml \Product \Attribute as AttributeAction ;
13
16
14
17
/**
15
18
* Product attribute validate controller.
16
19
*
17
20
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18
21
*/
19
- class Validate extends \ Magento \ Catalog \ Controller \ Adminhtml \ Product \Attribute
22
+ class Validate extends AttributeAction implements HttpGetActionInterface, HttpPostActionInterface
20
23
{
21
24
const DEFAULT_MESSAGE_KEY = 'message ' ;
22
25
Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \Swatches \Controller \Adminhtml \Product ;
9
9
10
+ use Magento \Framework \App \Request \Http as HttpRequest ;
11
+ use Magento \Framework \Data \Form \FormKey ;
10
12
use Magento \Framework \Exception \LocalizedException ;
11
13
12
14
/**
17
19
*/
18
20
class AttributeTest extends \Magento \TestFramework \TestCase \AbstractBackendController
19
21
{
22
+ /**
23
+ * @var FormKey
24
+ */
25
+ private $ formKey ;
26
+
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ protected function setUp ()
31
+ {
32
+ parent ::setUp ();
33
+
34
+ $ this ->formKey = $ this ->_objectManager ->get (FormKey::class);
35
+ }
36
+
20
37
/**
21
38
* Generate random hex color.
22
39
*
@@ -116,6 +133,7 @@ private function getAttributePreset() : array
116
133
{
117
134
return [
118
135
'form_key ' => 'XxtpPYjm2YPYUlAt ' ,
136
+ 'serialized_options ' => '[] ' ,
119
137
'frontend_label ' => [
120
138
0 => 'asdasd ' ,
121
139
1 => '' ,
@@ -178,7 +196,9 @@ public function testLargeOptionsDataSet(
178
196
int $ expectedOptionsCount ,
179
197
array $ expectedLabels
180
198
) : void {
199
+ $ this ->getRequest ()->setMethod (HttpRequest::METHOD_POST );
181
200
$ this ->getRequest ()->setPostValue ($ attributeData );
201
+ $ this ->getRequest ()->setPostValue ('form_key ' , $ this ->formKey ->getFormKey ());
182
202
$ this ->dispatch ('backend/catalog/product_attribute/save ' );
183
203
$ entityTypeId = $ this ->_objectManager ->create (
184
204
\Magento \Eav \Model \Entity::class
You can’t perform that action at this time.
0 commit comments