-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#12147: The function "isUsingStaticUrlsAllowed" (configuration settin…
…g "cms/wysiwyg/use_static_urls_in_catalog") doesn't have any effect with the WYSIWYG editor image insertion
- Loading branch information
1 parent
26a83d5
commit 94fdca7
Showing
4 changed files
with
67 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 0 additions & 104 deletions
104
...e/Magento/Catalog/Test/Unit/Observer/CatalogCheckIsUsingStaticUrlsAllowedObserverTest.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...ts/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/OnInsertTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images; | ||
|
||
use Magento\Cms\Helper\Wysiwyg\Images; | ||
use Magento\Framework\Data\Form\FormKey; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
use Magento\TestFramework\TestCase\AbstractBackendController; | ||
|
||
/** | ||
* Provide tests for OnInsert controller. | ||
* @magentoAppArea adminhtml | ||
*/ | ||
class OnInsertTest extends AbstractBackendController | ||
{ | ||
/** | ||
* Test OnIsert with turned on static urls in catalog. | ||
* | ||
* @magentoConfigFixture admin_store cms/wysiwyg/use_static_urls_in_catalog 1 | ||
* @return void | ||
*/ | ||
public function testExecuteWhithStaticUrls() | ||
{ | ||
$this->prepareRequest(); | ||
$this->dispatch('backend/cms/wysiwyg_images/onInsert'); | ||
$this->assertRegExp('/pub\/media\/wysiwyg\/testFilename/', $this->getResponse()->getBody()); | ||
} | ||
|
||
/** | ||
* Test OnIsert with turned off static urls in catalog. | ||
* | ||
* @magentoConfigFixture admin_store cms/wysiwyg/use_static_urls_in_catalog 0 | ||
* @return void | ||
*/ | ||
public function testExecuteWhithoutStaticUrls() | ||
{ | ||
$this->prepareRequest(); | ||
$this->dispatch('backend/cms/wysiwyg_images/onInsert'); | ||
$this->assertRegExp('/cms\/wysiwyg\/directive\/___directive/', $this->getResponse()->getBody()); | ||
} | ||
|
||
/** | ||
* Set necessary post data into request. | ||
* | ||
* @return void | ||
*/ | ||
private function prepareRequest() | ||
{ | ||
$this->getRequest()->setParams( | ||
[ | ||
'key' => 'testKey', | ||
'isAjax' => 'true', | ||
'filename' => Bootstrap::getObjectManager()->get(Images::class)->idEncode('testFilename'), | ||
'node' => 'root', | ||
'store' => '', | ||
'as_is' => '0', | ||
'form_key' => Bootstrap::getObjectManager()->get(FormKey::class)->getFormKey(), | ||
] | ||
); | ||
} | ||
} |