Ejemplo n.º 1
0
 /**
  * send the report (call this->sender->send()).
  *
  * @access private
  * @return void
  */
 private function tearDown() {
   $report = ReportFactory::getReport($this->filters, $this->kind);
   
   if(isset($this->sender)) {
     $next = $this->sender;
   }
   
   if (is_dir(self::sender)) {
     $d = dir(self::sender);
     while (false != ($file = $d->read())) {
       if(is_file(self::sender.$file)) {
         require_once self::sender.$file;
         $klass = Command::getClass($file);
         $this->sender = new $klass;
         $this->sender->setNext($next);
         $next = $this->sender;
       }
     }
   }
   
   if (isset($this->sender))
     $this->sender->send($report->format($this->formater), $this->name);
 }
Ejemplo n.º 2
0
 public function testStandardMailshareReport() {
   global $l_id, $l_name, $l_mail_server_name, $l_domain_name;
   $report = ReportFactory::getReport(array(),'mailshare');
   $formater = new GenericFormater();
   $formater->addField('id');
   $formater->addField('name');
   $formater->addField('mail_server_name');
   $formater->addField('domain_name');
   $output = $report->format($formater);
   $this->assertEquals($output, "$l_id\t$l_name\t$l_mail_server_name\t$l_domain_name\t\n"
                               ."1\tmailshare-test\tmail-server\tzz.com\t\n"
                               ."2\tmailshare-test-name-2\tmail-server\tzz.com\t\n"
                               ."3\tmailshare-test-name-3\tmail-server\tzz.com\t\n");
   unset($report);
   $filter1 = new GenericFilter('domain_name','=','global.virt');
   $report = ReportFactory::getReport(array($filter1),'mailshare');
   $output = $report->format($formater);
   $this->assertEquals($output, "$l_id\t$l_name\tmail_server_name\t$l_domain_name\t\n");
 }