/** * Tests if loading of an invalid backend is prevented. * * This test applies to valid classes which do not extend * Zend_Scheduler_Backend_Abstract. */ public function testCannotLoadInvalidBackend2() { require_once dirname(__FILE__) . '/_files/InvalidBackend.php'; $scheduler = new Zend_Scheduler(); try { $scheduler->setBackend('InvalidBackend'); } catch (Zend_Scheduler_Exception $e) { return true; } $this->fail('Allowed the use of an invalid custom backend'); }
/** * Singleton instance * * @return Zend_Scheduler */ public static function getScheduler() { if (!self::get(self::SCHEDULER) instanceof Zend_Scheduler) { $scheduler = new Zend_Scheduler(); $scheduler->setBackend(new Zend_Scheduler_Backend_Db(array('DbAdapter' => self::getDb(), 'tableName' => SQL_TABLE_PREFIX . 'scheduler', 'taskClass' => 'Tinebase_Scheduler_Task'))); self::set(self::SCHEDULER, $scheduler); } return self::get(self::SCHEDULER); }
/** * Tests if a valid (i.e., included) backend can be loaded. */ public function testCanLoadValidBackend() { $scheduler = new Zend_Scheduler(); try { $scheduler->setBackend('File'); } catch (Exception $e) { $this->fail('Denied the use of a valid backend'); } }