/** * Tests the truncateModels function * * @return void * @covers ::truncateModels */ public function testTruncateModels() { $this->_shell->expects($this->at(0))->method('out')->with($this->equalTo('Truncate model Apple...')); $this->_shell->expects($this->at(1))->method('out')->with($this->equalTo('Truncate model Banana...')); $this->_shell->expects($this->at(2))->method('out')->with($this->equalTo('Truncate model Pear...')); $models = array('Apple', 'Banana', 'Pear'); $this->_truncator->truncateModels($models); }
/** * Tests the saveSeeds method when saving fails * * @return void * @covers ::saveSeeds */ public function testSaveSeedsNotSaved() { $this->_createProcessorMock(array('_getModel')); $seeds = array('seeds'); $model = $this->getMock('Apple', array('saveAll')); $options = array('validate' => 'first'); $model->validationErrors = 'test123'; $this->_seeder->expects($this->at(0))->method('getValidateSeeding')->will($this->returnValue('first')); $this->_processor->expects($this->at(0))->method('_getModel')->will($this->returnValue($model)); $model->expects($this->at(0))->method('saveAll')->with($this->equalTo($seeds), $this->equalTo($options))->will($this->returnValue(false)); $this->_seeder->expects($this->at(1))->method('out')->with($this->equalTo('Seeds could not be saved successfully!')); $this->_seeder->expects($this->at(2))->method('out')->with($this->equalTo("Data validation errors: 'test123'")); $this->_processor->saveSeeds($seeds); }