Example #1
0
 /**
  * Initializes the Mail_Queue in {@link self::$queue}.
  *
  * @return void
  * @uses   MDB2_Driver_SQLite
  */
 public function setUp()
 {
     if (!extension_loaded('sqlite')) {
         $this->markTestSkipped("You need ext/sqlite to run this test suite.");
         return;
     }
     $this->dsn = 'sqlite:///' . __DIR__ . "/{$this->db}?mode=0644";
     $this->setUpDatabase($this->dsn);
     $container_opts = array('type' => 'mdb2', 'dsn' => $this->dsn, 'mail_table' => $this->table);
     /**
      * @see Mail_mock
      */
     $mail_opts = array('driver' => 'mock');
     $this->queue = new Mail_Queue($container_opts, $mail_opts);
     if ($this->queue->hasErrors()) {
         $errors = $this->queue->getErrors();
         $fail = "The following errors occurred:\n";
         foreach ($errors as $error) {
             $fail .= $error->getMessage() . "\n";
         }
         $this->fail($fail);
     }
 }
Example #2
0
File: Queue.php Project: roojs/pear
 /**
  * Factory is used to initialize Mail_Queue, this is necessary to catch possible
  * errors during the initialization.
  *
  * @param array $container_options Options for the container.
  * @param array $mail_options Options for mail.
  *
  * @return mixed Mail_Queue|Mail_Queue_Error
  * @see self::Mail_Queue()
  * @since 1.2.3
  */
 function factory($container_options, $mail_options)
 {
     $obj = new Mail_Queue($container_options, $mail_options);
     if ($obj->hasErrors()) {
         /**
          * @see self::getErrors()
          */
         return new Mail_Queue_Error(MAILQUEUE_ERROR, $this->pearErrorMode, E_USER_ERROR, __FILE__, __LINE__);
     }
     return $obj;
 }