public function setUp()
 {
     parent::setUp();
     $this->user = User::getByUsername('super');
     Yii::app()->user->userModel = $this->user;
     EmailAccount::deleteAll();
     EmailMessage::deleteAll();
     EmailMessageContent::deleteAll();
     EmailMessageSender::deleteAll();
     EmailMessageRecipient::deleteAll();
     EmailMessageSendError::deleteAll();
     FileModel::deleteAll();
 }
 public function setUp()
 {
     parent::setUp();
     $this->user = User::getByUsername('super');
     Yii::app()->user->userModel = $this->user;
     EmailAccount::deleteAll();
     EmailMessage::deleteAll();
     EmailMessageContent::deleteAll();
     EmailMessageSender::deleteAll();
     EmailMessageRecipient::deleteAll();
     EmailMessageSendError::deleteAll();
     FileModel::deleteAll();
     if (!EmailMessageTestHelper::isSetEmailAccountsTestConfiguration()) {
         $this->markTestSkipped('Please fix the test email settings');
     }
 }
Ejemplo n.º 3
0
 /**
  * Deletes this instance
  */
 public function delete()
 {
     $where = self::$questionnaireTable->getAdapter()->quoteInto('questionnaireID = ?', intVal($this->questionnaireID));
     $transactionNumber = self::startSerializableTransaction();
     $this->_loadInstances();
     if ($this->hasVisibleInstances()) {
         throw new Exception('Cannot delete questionnaire while instances exist');
     }
     foreach ($this->instances as $instance) {
         $instance->delete();
     }
     self::$questionnaireTable->delete($where);
     self::dbCommit($transactionNumber);
     // Delete files after transaction to ensure a healthy state such that the worst case
     // scenario is that there may be orphaned files left on disk if the file operation
     // is not successful.
     $files = new FileModel($this);
     $files->deleteAll();
 }