|
@@ 397-415 (lines=19) @@
|
| 394 |
|
* @return void |
| 395 |
|
* @covers ::saveSeeds |
| 396 |
|
*/ |
| 397 |
|
public function testSaveSeedsValidateFalse() { |
| 398 |
|
$this->_createProcessorMock(array('_getModel')); |
| 399 |
|
$seeds = array('seeds'); |
| 400 |
|
$model = $this->getMock('Apple', array('saveAll')); |
| 401 |
|
$options = array( |
| 402 |
|
'validate' => false |
| 403 |
|
); |
| 404 |
|
|
| 405 |
|
$this->_seeder->expects($this->at(0))->method('getValidateSeeding')->will($this->returnValue('false')); |
| 406 |
|
$this->_processor->expects($this->at(0))->method('_getModel')->will($this->returnValue($model)); |
| 407 |
|
$model->expects($this->at(0))->method('saveAll')->with( |
| 408 |
|
$this->equalTo($seeds), |
| 409 |
|
$this->equalTo($options) |
| 410 |
|
)->will($this->returnValue(true)); |
| 411 |
|
|
| 412 |
|
$this->_seeder->expects($this->never())->method('out'); |
| 413 |
|
|
| 414 |
|
$this->_processor->saveSeeds($seeds); |
| 415 |
|
} |
| 416 |
|
|
| 417 |
|
/** |
| 418 |
|
* Tests the saveSeeds method when validate casts to true |
|
@@ 423-441 (lines=19) @@
|
| 420 |
|
* @return void |
| 421 |
|
* @covers ::saveSeeds |
| 422 |
|
*/ |
| 423 |
|
public function testSaveSeedsValidateTrue() { |
| 424 |
|
$this->_createProcessorMock(array('_getModel')); |
| 425 |
|
$seeds = array('seeds'); |
| 426 |
|
$model = $this->getMock('Apple', array('saveAll')); |
| 427 |
|
$options = array( |
| 428 |
|
'validate' => true |
| 429 |
|
); |
| 430 |
|
|
| 431 |
|
$this->_seeder->expects($this->at(0))->method('getValidateSeeding')->will($this->returnValue('true')); |
| 432 |
|
$this->_processor->expects($this->at(0))->method('_getModel')->will($this->returnValue($model)); |
| 433 |
|
$model->expects($this->at(0))->method('saveAll')->with( |
| 434 |
|
$this->equalTo($seeds), |
| 435 |
|
$this->equalTo($options) |
| 436 |
|
)->will($this->returnValue(true)); |
| 437 |
|
|
| 438 |
|
$this->_seeder->expects($this->never())->method('out'); |
| 439 |
|
|
| 440 |
|
$this->_processor->saveSeeds($seeds); |
| 441 |
|
} |
| 442 |
|
|
| 443 |
|
/** |
| 444 |
|
* Tests the saveSeeds method when saving fails |