예제 #1
0
 /**
  * Tests if tasks can be serialized, unserialized, and successfully loaded.
  */
 public function testCanSerializeTasks()
 {
     $scheduler = new Zend_Scheduler();
     $task1 = new Zend_Scheduler_Task();
     $task1->setRequest('index');
     $task2 = new Zend_Scheduler_Task();
     $task2->setRequest('index');
     $scheduler->addTask('test1', $task1);
     $scheduler->addTask('test2', $task2);
     try {
         $serialized = $scheduler->serializeTasks();
     } catch (Exception $e) {
         $this->fail('Could not serialize tasks');
     }
     $scheduler = new Zend_Scheduler();
     $scheduler->addTasks(unserialize($serialized));
     $this->assertTrue($scheduler->hasTask('test1'), 'Unserialized tasks could not be added');
     $this->assertTrue($scheduler->hasTask('test2'), 'Second unserialized task could not be added');
 }