Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SaveTest.php
Go to the documentation of this file.
1 <?php
8 
12 
17 {
21  private $formKey;
22 
26  protected $resource = 'Magento_Config::config_design';
27 
31  protected $uri = 'backend/theme/design_config/save';
32 
36  protected function setUp()
37  {
38  parent::setUp();
39 
40  $this->formKey = $this->_objectManager->get(
41  FormKey::class
42  );
43  $this->httpMethod = Http::METHOD_POST;
44  }
45 
51  public function testSave()
52  {
53  $params = $this->getRequestParams();
54  $this->getRequest()->setParams($params);
55  $error = '';
56  try {
57  $this->dispatch($this->uri);
58  } catch (\Exception $e) {
59  $error = $e->getMessage();
60  }
61 
62  self::assertEmpty($error, $error);
63  }
64 
70  private function getRequestParams()
71  {
72  return [
73  'theme_theme_id' => '',
74  'pagination_pagination_frame' => '5',
75  'pagination_pagination_frame_skip' => '',
76  'pagination_anchor_text_for_previous' => '',
77  'pagination_anchor_text_for_next' => '',
78  'head_default_title' => 'Magento Commerce',
79  'head_title_prefix' => '',
80  'head_title_suffix' => '',
81  'head_default_description' => '',
82  'head_default_keywords' => '',
83  'head_includes' => '',
84  'head_demonotice' => '0',
85  'header_logo_width' => '',
86  'header_logo_height' => '',
87  'header_logo_alt' => '',
88  'header_welcome' => 'Default welcome msg!',
89  'footer_copyright' => 'Copyright © 2013-present Magento, Inc. All rights reserved.',
90  'footer_absolute_footer' => '',
91  'default_robots' => 'INDEX,FOLLOW',
92  'custom_instructions' => '',
93  'watermark_image_size' => '',
94  'watermark_image_imageOpacity' => '',
95  'watermark_image_position' => 'stretch',
96  'watermark_small_image_size' => '',
97  'watermark_small_image_imageOpacity' => '',
98  'watermark_small_image_position' => 'stretch',
99  'watermark_thumbnail_size' => '',
100  'watermark_thumbnail_imageOpacity' => '',
101  'watermark_thumbnail_position' => 'stretch',
102  'email_logo_alt' => 'test',
103  'email_logo_width' => '200',
104  'email_logo_height' => '100',
105  'email_header_template' => 'design_email_header_template',
106  'email_footer_template' => 'design_email_footer_template',
107  'watermark_swatch_image_size' => '',
108  'watermark_swatch_image_imageOpacity' => '',
109  'watermark_swatch_image_position' => 'stretch',
110  'scope' => 'default',
111  'form_key' => $this->formKey->getFormKey(),
112  ];
113  }
114 
118  public function testAclHasAccess()
119  {
120  $this->getRequest()->setParams(
121  [
122  'form_key' => $this->formKey->getFormKey()
123  ]
124  );
125 
126  parent::testAclHasAccess();
127  }
128 }
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18