|
@@ 252-271 (lines=20) @@
|
| 249 |
|
* @covers ::_promptForSeeder |
| 250 |
|
* @covers ::_executeSeederTask |
| 251 |
|
*/ |
| 252 |
|
public function testMainExecuteByNameSeederPrompt() { |
| 253 |
|
$this->_createShellMock( |
| 254 |
|
array('out', 'in', '_getSeederTasks', '_executeSeederTask') |
| 255 |
|
); |
| 256 |
|
|
| 257 |
|
$tasks = array('Apple', 'Banana'); |
| 258 |
|
$this->_shell->params['no-truncate'] = 'foo'; |
| 259 |
|
$this->_shell->expects($this->at(0))->method('_getSeederTasks')->will($this->returnValue($tasks)); |
| 260 |
|
$this->_shell->expects($this->at(4))->method('in')->will($this->returnValue('Apple')); |
| 261 |
|
$this->_shell->expects($this->at(5))->method('out')->with( |
| 262 |
|
$this->equalTo('Execute Apple seeder...') |
| 263 |
|
); |
| 264 |
|
$this->_shell->expects($this->at(6))->method('_executeSeederTask')->with( |
| 265 |
|
$this->equalTo('Apple'), $this->equalTo('foo') |
| 266 |
|
); |
| 267 |
|
|
| 268 |
|
$this->_shell->main(); |
| 269 |
|
|
| 270 |
|
$this->assertEquals('Apple', $this->_shell->args[0]); |
| 271 |
|
} |
| 272 |
|
|
| 273 |
|
/** |
| 274 |
|
* Test the main method when executing one of the prompted (non-existing) seeders by number |
|
@@ 281-300 (lines=20) @@
|
| 278 |
|
* @covers ::_promptForSeeder |
| 279 |
|
* @covers ::_executeSeederTask |
| 280 |
|
*/ |
| 281 |
|
public function testMainExecuteByNumberSeederPrompt() { |
| 282 |
|
$this->_createShellMock( |
| 283 |
|
array('out', 'in', '_getSeederTasks', '_executeSeederTask') |
| 284 |
|
); |
| 285 |
|
|
| 286 |
|
$tasks = array('Apple', 'Banana'); |
| 287 |
|
$this->_shell->params['no-truncate'] = 'foo'; |
| 288 |
|
$this->_shell->expects($this->at(0))->method('_getSeederTasks')->will($this->returnValue($tasks)); |
| 289 |
|
$this->_shell->expects($this->at(4))->method('in')->will($this->returnValue('1')); |
| 290 |
|
$this->_shell->expects($this->at(5))->method('out')->with( |
| 291 |
|
$this->equalTo('Execute Apple seeder...') |
| 292 |
|
); |
| 293 |
|
$this->_shell->expects($this->at(6))->method('_executeSeederTask')->with( |
| 294 |
|
$this->equalTo('Apple'), $this->equalTo('foo') |
| 295 |
|
); |
| 296 |
|
|
| 297 |
|
$this->_shell->main(); |
| 298 |
|
|
| 299 |
|
$this->assertEquals('Apple', $this->_shell->args[0]); |
| 300 |
|
} |
| 301 |
|
|
| 302 |
|
/** |
| 303 |
|
* Test the main method when executing a seeder given by parameter |