Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setMultiline example
public
function
testGetNormalizerDefault
(
)
{
self::
assertNull
(
$this
->question->
getNormalizer
(
)
)
;
}
/** * @dataProvider providerTrueFalse */
public
function
testSetMultiline
(
bool
$multiline
)
{
self::
assertSame
(
$this
->question,
$this
->question->
setMultiline
(
$multiline
)
)
;
self::
assertSame
(
$multiline
,
$this
->question->
isMultiline
(
)
)
;
}
public
function
testIsMultilineDefault
(
)
{
self::
assertFalse
(
$this
->question->
isMultiline
(
)
)
;
}
}
EOD;
$response
=
$this
->
getInputStream
(
$essay
)
;
$dialog
=
new
QuestionHelper
(
)
;
$question
=
new
Question
(
'Write an essay'
)
;
$question
->
setMultiline
(
true
)
;
$this
->
assertSame
(
$essay
,
$dialog
->
ask
(
$this
->
createStreamableInputInterfaceMock
(
$response
)
,
$this
->
createOutputInterface
(
)
,
$question
)
)
;
}
public
function
testAskMultilineResponseWithSingleNewline
(
)
{
$response
=
$this
->
getInputStream
(
\PHP_EOL
)
;
$dialog
=
new
QuestionHelper
(
)
;
$question
=
new
Question
(
'Write an essay'
)
;
public
function
testAskMultilineQuestionIncludesHelpText
(
)
{
$expected
= 'Write an essay (press Ctrl+D to continue)';
if
(
'Windows' === \PHP_OS_FAMILY
)
{
$expected
= 'Write an essay (press Ctrl+Z then Enter to continue)';
}
$question
=
new
Question
(
'Write an essay'
)
;
$question
->
setMultiline
(
true
)
;
$helper
=
new
SymfonyQuestionHelper
(
)
;
$input
=
$this
->
createStreamableInputInterfaceMock
(
$this
->
getInputStream
(
'\\'
)
)
;
$helper
->
ask
(
$input
,
$output
=
$this
->
createOutputInterface
(
)
,
$question
)
;
$this
->
assertOutputContains
(
$expected
,
$output
)
;
}
}