|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | + |
| 7 | +namespace Magento\Theme\Controller\Adminhtml\System\Design\Config; |
| 8 | + |
| 9 | +use Magento\Framework\Data\Form\FormKey; |
| 10 | +use Magento\TestFramework\TestCase\AbstractBackendController; |
| 11 | + |
| 12 | +/** |
| 13 | + * Class SaveTest @covers \Magento\Theme\Controller\Adminhtml\Design\Config\Save |
| 14 | + */ |
| 15 | +class SaveTest extends AbstractBackendController |
| 16 | +{ |
| 17 | + /** |
| 18 | + * @inheritdoc |
| 19 | + */ |
| 20 | + protected $resource = 'Magento_Config::config_design'; |
| 21 | + |
| 22 | + /** |
| 23 | + * @inheritdoc |
| 24 | + */ |
| 25 | + protected $uri = 'backend/theme/design_config/save'; |
| 26 | + |
| 27 | + /** |
| 28 | + * Test design configuration save valid values. |
| 29 | + * |
| 30 | + * @return void |
| 31 | + */ |
| 32 | + public function testSave() |
| 33 | + { |
| 34 | + $params = $this->getRequestParams(); |
| 35 | + $this->getRequest()->setParams($params); |
| 36 | + $error = ''; |
| 37 | + try { |
| 38 | + $this->dispatch($this->uri); |
| 39 | + } catch (\Exception $e) { |
| 40 | + $error = $e->getMessage(); |
| 41 | + } |
| 42 | + |
| 43 | + self::assertEmpty($error, $error); |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Provide test request params for testSave(). |
| 48 | + * |
| 49 | + * @return array |
| 50 | + */ |
| 51 | + private function getRequestParams() |
| 52 | + { |
| 53 | + return [ |
| 54 | + 'theme_theme_id' => '', |
| 55 | + 'pagination_pagination_frame' => '5', |
| 56 | + 'pagination_pagination_frame_skip' => '', |
| 57 | + 'pagination_anchor_text_for_previous' => '', |
| 58 | + 'pagination_anchor_text_for_next' => '', |
| 59 | + 'head_default_title' => 'Magento Commerce', |
| 60 | + 'head_title_prefix' => '', |
| 61 | + 'head_title_suffix' => '', |
| 62 | + 'head_default_description' => '', |
| 63 | + 'head_default_keywords' => '', |
| 64 | + 'head_includes' => '', |
| 65 | + 'head_demonotice' => '0', |
| 66 | + 'header_logo_width' => '', |
| 67 | + 'header_logo_height' => '', |
| 68 | + 'header_logo_alt' => '', |
| 69 | + 'header_welcome' => 'Default welcome msg!', |
| 70 | + 'footer_copyright' => 'Copyright © 2013-2017 Magento, Inc. All rights reserved.', |
| 71 | + 'footer_absolute_footer' => '', |
| 72 | + 'default_robots' => 'INDEX,FOLLOW', |
| 73 | + 'custom_instructions' => '', |
| 74 | + 'watermark_image_size' => '', |
| 75 | + 'watermark_image_imageOpacity' => '', |
| 76 | + 'watermark_image_position' => 'stretch', |
| 77 | + 'watermark_small_image_size' => '', |
| 78 | + 'watermark_small_image_imageOpacity' => '', |
| 79 | + 'watermark_small_image_position' => 'stretch', |
| 80 | + 'watermark_thumbnail_size' => '', |
| 81 | + 'watermark_thumbnail_imageOpacity' => '', |
| 82 | + 'watermark_thumbnail_position' => 'stretch', |
| 83 | + 'email_logo_alt' => 'test', |
| 84 | + 'email_logo_width' => '200', |
| 85 | + 'email_logo_height' => '100', |
| 86 | + 'email_header_template' => 'design_email_header_template', |
| 87 | + 'email_footer_template' => 'design_email_footer_template', |
| 88 | + 'watermark_swatch_image_size' => '', |
| 89 | + 'watermark_swatch_image_imageOpacity' => '', |
| 90 | + 'watermark_swatch_image_position' => 'stretch', |
| 91 | + 'scope' => 'default', |
| 92 | + 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(), |
| 93 | + ]; |
| 94 | + } |
| 95 | +} |
0 commit comments