|
@@ 144-157 (lines=14) @@
|
| 141 |
|
/** |
| 142 |
|
* Tests DefaultIO::ask |
| 143 |
|
*/ |
| 144 |
|
public function testAsk() |
| 145 |
|
{ |
| 146 |
|
$input = $this->getInputMock(); |
| 147 |
|
$output = $this->getOutputMock(); |
| 148 |
|
$helper = $this->getHelperSetMock(); |
| 149 |
|
$questionHelper = $this->getQuestionHelper(); |
| 150 |
|
|
| 151 |
|
$helper->expects($this->once())->method('get')->willReturn($questionHelper); |
| 152 |
|
$questionHelper->expects($this->once())->method('ask')->willReturn(true); |
| 153 |
|
|
| 154 |
|
$io = new DefaultIO($input, $output, $helper); |
| 155 |
|
$answer = $io->ask('foo'); |
| 156 |
|
$this->assertTrue($answer); |
| 157 |
|
} |
| 158 |
|
|
| 159 |
|
/** |
| 160 |
|
* Tests DefaultIO::askConfirmation |
|
@@ 162-175 (lines=14) @@
|
| 159 |
|
/** |
| 160 |
|
* Tests DefaultIO::askConfirmation |
| 161 |
|
*/ |
| 162 |
|
public function testAskConfirmation() |
| 163 |
|
{ |
| 164 |
|
$input = $this->getInputMock(); |
| 165 |
|
$output = $this->getOutputMock(); |
| 166 |
|
$helper = $this->getHelperSetMock(); |
| 167 |
|
$questionHelper = $this->getQuestionHelper(); |
| 168 |
|
|
| 169 |
|
$helper->expects($this->once())->method('get')->willReturn($questionHelper); |
| 170 |
|
$questionHelper->expects($this->once())->method('ask')->willReturn(true); |
| 171 |
|
|
| 172 |
|
$io = new DefaultIO($input, $output, $helper); |
| 173 |
|
$answer = $io->askConfirmation('foo'); |
| 174 |
|
$this->assertTrue($answer); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
/** |
| 178 |
|
* Tests DefaultIO::askAbdValidate |
|
@@ 180-193 (lines=14) @@
|
| 177 |
|
/** |
| 178 |
|
* Tests DefaultIO::askAbdValidate |
| 179 |
|
*/ |
| 180 |
|
public function testAskAndValidate() |
| 181 |
|
{ |
| 182 |
|
$input = $this->getInputMock(); |
| 183 |
|
$output = $this->getOutputMock(); |
| 184 |
|
$helper = $this->getHelperSetMock(); |
| 185 |
|
$questionHelper = $this->getQuestionHelper(); |
| 186 |
|
|
| 187 |
|
$helper->expects($this->once())->method('get')->willReturn($questionHelper); |
| 188 |
|
$questionHelper->expects($this->once())->method('ask')->willReturn(true); |
| 189 |
|
|
| 190 |
|
$io = new DefaultIO($input, $output, $helper); |
| 191 |
|
$answer = $io->askAndValidate('foo', function() { return true; }); |
| 192 |
|
$this->assertTrue($answer); |
| 193 |
|
} |
| 194 |
|
|
| 195 |
|
/** |
| 196 |
|
* Tests DefaultIO::write |