Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Theme
Controller
Adminhtml
System
Design
ThemeControllerTest.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Theme\Controller\Adminhtml\System\Design
;
7
8
use
Magento\Framework\Filesystem
;
9
use
Magento\Framework\Filesystem\DirectoryList
;
10
14
class
ThemeControllerTest
extends
\Magento\TestFramework\TestCase\AbstractBackendController
15
{
16
public
function
testUploadJsAction
()
17
{
18
$name
=
'simple-js-file.js'
;
19
$this->createUploadFixture(
$name
);
20
$theme
= $this->_objectManager->create(\
Magento
\Framework\View\Design\ThemeInterface::class)
21
->getCollection()
22
->getFirstItem();
23
24
$this->
getRequest
()->setPostValue(
'id'
,
$theme
->getId());
25
$this->dispatch(
'backend/admin/system_design_theme/uploadjs'
);
26
$output
= $this->
getResponse
()->getBody();
27
$this->assertContains(
'"error":false'
,
$output
);
28
$this->assertContains(
$name
,
$output
);
29
}
30
37
private
function
createUploadFixture(
$name
)
38
{
40
$filesystem
= $this->_objectManager->get(\
Magento
\Framework\Filesystem::class);
41
$tmpDir =
$filesystem
->getDirectoryWrite(
DirectoryList::SYS_TMP
);
42
$subDir = str_replace(
'\\'
,
'_'
, __CLASS__);
43
$tmpDir->create($subDir);
44
$target
= $tmpDir->getAbsolutePath(
"{$subDir}/{$name}"
);
45
copy(
__DIR__
.
"/_files/{$name}"
,
$target
);
46
$_FILES = [
47
'js_files_uploader'
=> [
48
'name'
=>
'simple-js-file.js'
,
49
'type'
=>
'application/x-javascript'
,
50
'tmp_name'
=>
$target
,
51
'error'
=>
'0'
,
52
'size'
=>
'28'
,
53
],
54
];
55
}
56
}
Magento\TestFramework\TestCase\AbstractController\getRequest
getRequest()
Definition:
AbstractController.php:124
Magento\Framework\Filesystem
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$target
$target
Definition:
skip.phtml:8
Magento\Theme\Controller\Adminhtml\System\Design\ThemeControllerTest
Definition:
ThemeControllerTest.php:14
Magento\Theme\Controller\Adminhtml\System\Design
Magento\TestFramework\TestCase\AbstractController\getResponse
getResponse()
Definition:
AbstractController.php:137
Magento\Theme\Controller\Adminhtml\System\Design\ThemeControllerTest\testUploadJsAction
testUploadJsAction()
Definition:
ThemeControllerTest.php:16
Magento\Framework\Filesystem\DirectoryList\SYS_TMP
const SYS_TMP
Definition:
DirectoryList.php:36
$output
$output
Definition:
classmap_generator.php:100
Magento
$theme
$theme
Definition:
theme_rollback.php:9
Magento\Framework\Filesystem\DirectoryList
Definition:
DirectoryList.php:24
$filesystem
$filesystem
Definition:
validate_image.php:10
$name
if(!isset($_GET['name'])) $name
Definition:
log.php:14
Magento\TestFramework\TestCase\AbstractBackendController
Definition:
AbstractBackendController.php:15