Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ConsoleEvent example
$this
->
assertEquals
(
[
]
,
$record
[
'extra'
]
)
;
}
private
function
getConsoleEvent
(
)
: ConsoleEvent
{
$input
=
$this
->
createMock
(
InputInterface::
class
)
;
$input
->
method
(
'getArguments'
)
->
willReturn
(
self::TEST_ARGUMENTS
)
;
$input
->
method
(
'getOptions'
)
->
willReturn
(
self::TEST_OPTIONS
)
;
$command
=
$this
->
createMock
(
Command::
class
)
;
$command
->
method
(
'getName'
)
->
willReturn
(
self::TEST_NAME
)
;
return
new
ConsoleEvent
(
$command
,
$input
,
$this
->
createMock
(
OutputInterface::
class
)
)
;
}
}
$this
->
assertNull
(
$h
)
;
}
public
function
testConsoleEvent
(
)
{
$dispatcher
=
new
EventDispatcher
(
)
;
$listener
=
new
DebugHandlersListener
(
null
)
;
$app
=
$this
->
createMock
(
Application::
class
)
;
$app
->
expects
(
$this
->
once
(
)
)
->
method
(
'getHelperSet'
)
->
willReturn
(
new
HelperSet
(
)
)
;
$command
=
new
Command
(
__FUNCTION__
)
;
$command
->
setApplication
(
$app
)
;
$event
=
new
ConsoleEvent
(
$command
,
new
ArgvInput
(
)
,
new
ConsoleOutput
(
)
)
;
$dispatcher
->
addSubscriber
(
$listener
)
;
$xListeners
=
[
KernelEvents::REQUEST =>
[
[
$listener
, 'configure'
]
]
,
ConsoleEvents::COMMAND =>
[
[
$listener
, 'configure'
]
]
,
]
;
$this
->
assertSame
(
$xListeners
,
$dispatcher
->
getListeners
(
)
)
;
$exception
= null;
$eHandler
=
new
ErrorHandler
(
)
;