8000 [Console] fix test using deprecated code · symfony/symfony@2caee94 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2caee94

Browse files
[Console] fix test using deprecated code
1 parent 55978d7 commit 2caee94

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,52 +95,52 @@ public function testAskChoiceNonInteractive()
9595

9696
$helperSet = new HelperSet(array(new FormatterHelper()));
9797
$questionHelper->setHelperSet($helperSet);
98-
$questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"));
98+
$inputStream = $this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n");
9999

100100
$heroes = array('Superman', 'Batman', 'Spiderman');
101101

102102
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0');
103103

104-
$this->assertSame('Superman', $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question));
104+
$this->assertSame('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question));
105105

106106
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, 'Batman');
107-
$this->assertSame('Batman', $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question));
107+
$this->assertSame('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question));
108108

109109
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null);
110-
$this->assertNull($questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question));
110+
$this->assertNull($questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question));
111111

112112
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0');
113113
$question->setValidator(null);
114-
$this->assertSame('Superman', $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question));
114+
$this->assertSame('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question));
115115

116116
try {
117117
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null);
118-
$questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question);
118+
$questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question);
119119
} catch (\InvalidArgumentException $e) {
120120
$this->assertSame('Value "" is invalid', $e->getMessage());
121121
}
122122

123123
$question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, 1');
124124
$question->setMultiselect(true);
125-
$this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question));
125+
$this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question));
126126

127127
$question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, 1');
128128
$question->setMultiselect(true);
129129
$question->setValidator(null);
130-
$this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question));
130+
$this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question));
131131

132132
$question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, Batman');
133133
$question->setMultiselect(true);
134-
$this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question));
134+
$this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question));
135135

136136
$question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, null);
137137
$question->setMultiselect(true);
138-
$this->assertNull($questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question));
138+
$this->assertNull($questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question));
139139

140140
try {
141141
$question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '');
142142
$question->setMultiselect(true);
143-
$questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question);
143+
$questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question);
144144
} catch (\InvalidArgumentException $e) {
145145
$this->assertSame('Value "" is invalid', $e->getMessage());
146146
}

0 commit comments

Comments
 (0)
0