Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
uploadExtensions example
$this
->
createMock
(
PluginService::
class
)
,
$this
->
createMock
(
PluginManagementService::
class
)
)
;
$request
=
new
Request
(
)
;
$file
=
$this
->
createMock
(
UploadedFile::
class
)
;
$file
->
method
(
'getMimeType'
)
->
willReturn
(
'foo'
)
;
$file
->
method
(
'getPathname'
)
->
willReturn
(
tempnam
(
sys_get_temp_dir
(
)
, __METHOD__
)
)
;
$request
->files->
set
(
'file',
$file
)
;
static
::
expectException
(
PluginNotAZipFileException::
class
)
;
$controller
->
uploadExtensions
(
$request
, Context::
createDefaultContext
(
)
)
;
}
public
function
testUploadExtensionsWithInvalidPermissions
(
)
: void
{
$browser
=
$this
->
getBrowser
(
)
;
$this
->
authorizeBrowser
(
$browser
,
[
]
,
[
'system.plugin_maintain'
]
)
;
$browser
->
request
(
'POST', '/api/_action/extension/upload'
)
;
$response
=
$browser
->
getResponse
(
)
;
static
::
assertEquals
(
403,
$response
->
getStatusCode
(
)
)
;