protected function tearDown()
 {
     $testJobs = Opus_Job::getAll($this->jobIds);
     foreach ($testJobs as $job) {
         $job->delete();
     }
     Zend_Registry::set('Zend_Config', $this->__configBackup);
     parent::tearDown();
 }
 public function testCreateWorkerJobIfAsyncEnabled()
 {
     $this->config->merge(new Zend_Config(array('runjobs' => array('asynchronous' => 1))));
     $this->assertEquals(0, Opus_Job::getCount(), 'test data changed.');
     $doc = $this->createTestDocument();
     $doc->setLanguage("eng");
     $title = new Opus_Title();
     $title->setValue("Test Document");
     $title->setLanguage("eng");
     $doc->addTitleMain($title);
     $doc->store();
     $this->notification->prepareMail($doc, Application_Util_Notification::SUBMISSION, 'http://localhost/foo/1');
     $mailJobs = Opus_Job::getByLabels(array(Opus_Job_Worker_MailNotification::LABEL));
     $this->assertEquals(1, count($mailJobs), 'Expected 1 mail job');
     $jobs = Opus_Job::getAll();
     if (!empty($jobs)) {
         foreach ($jobs as $job) {
             $job->delete();
         }
     }
 }