/**
  * Tests any given backend.
  *
  * @param Zend_Scheduler $scheduler
  * @param Zend_Scheduler_Backend_Abstract $backend
  */
 protected function _canUseBackend(Zend_Scheduler_Backend_Abstract $backend)
 {
     $controller = Zend_Controller_Front_Mock::getInstance();
     $controller->returnResponse(true);
     $controller->throwExceptions(true);
     $scheduler = new Zend_Scheduler($backend);
     $scheduler->setController($controller);
     $scheduler->setLimit(1);
     // Only execute one task
     $task = new Zend_Scheduler_Task();
     $task->addRequest('scheduled', 'task1');
     $task->addRequest('scheduled', 'task2');
     $scheduler->addTask('test1', $task);
     $task = new Zend_Scheduler_Task();
     $task->setRequest('scheduled', 'task3');
     $scheduler->addTask('test2', $task);
     $task = new Zend_Scheduler_Task();
     $task->setRequest('scheduled', 'task4');
     $scheduler->addTask('test3', $task);
     try {
         $scheduler->run();
     } catch (Zend_Scheduler_Exception $e) {
         $this->fail('Could not execute tasks: ' . $e->getMessage());
     }
     try {
         $tasks = $backend->loadQueue();
     } catch (Zend_Scheduler_Exception $e) {
         $this->fail('Could not load task queue');
     }
     $taskCount = count($tasks);
     $this->assertEquals(2, $taskCount, "Expected 2 tasks in queue, received {$taskCount}");
     $tasksFound = isset($tasks['test2']) and isset($tasks['test3']);
     $this->assertTrue($tasksFound, 'Did not find expected tasks in queue');
     $this->assertType('Zend_Scheduler_Task', $tasks['test2'], 'Received task did not match type');
 }