public function testRecordSaving() { $this->_initAdapter('User'); $form = new CU_Form_Model(array('model' => 'User', 'adapter' => $this->_adapter)); $form->getElementForColumn('login')->setValue('Test'); $form->getElementForColumn('password')->setValue('Test'); //Should not get called if persist param is false $this->_adapter->expects($this->never())->method('saveRecord'); $form->save(false); $this->_initAdapter('User'); $form->setAdapter($this->_adapter); $this->_adapter->expects($this->once())->method('saveRecord'); //Should get called twice as we set two values $this->_adapter->expects($this->exactly(2))->method('setRecordValue'); $record = $form->save(); }