Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CustomDefaultCommandApplication example
$command
=
new
\
FooCommand
(
)
;
$application
=
new
Application
(
)
;
$application
->
setAutoExit
(
false
)
;
$application
->
add
(
$command
)
;
$application
->
setDefaultCommand
(
$command
->
getName
(
)
)
;
$tester
=
new
ApplicationTester
(
$application
)
;
$tester
->
run
(
[
]
,
[
'interactive' => false
]
)
;
$this
->
assertEquals
(
'called'.\PHP_EOL,
$tester
->
getDisplay
(
)
, 'Application runs the default set command if different from \'list\' command'
)
;
$application
=
new
CustomDefaultCommandApplication
(
)
;
$application
->
setAutoExit
(
false
)
;
$tester
=
new
ApplicationTester
(
$application
)
;
$tester
->
run
(
[
]
,
[
'interactive' => false
]
)
;
$this
->
assertEquals
(
'called'.\PHP_EOL,
$tester
->
getDisplay
(
)
, 'Application runs the default set command if different from \'list\' command'
)
;
}
public
function
testSetRunCustomDefaultCommandWithOption
(
)
{
$command
=
new
\
FooOptCommand
(
)
;