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