Beispiel #1
0
 public function testReportCommand() {
   global $l_id, $l_login, $l_name, $l_firstname, $l_domain_name;
   $cmd = new TestCommand();
   $cmd->doIt();
   $mailData = Stato_StaticTransport::getMailQ();
   $this->assertEquals('Rapport d\'exploitation : Les utilisateurs qui ne sont pas dans global.virt',$mailData[0]['subject']);
   $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[0]['to']);
   $this->assertContains("Rapport d'exploitation du traitement \"Les utilisateurs qui ne sont pas dans global.virt\" :\n"
                        ."\n"
                        ."$l_id\t$l_login\t$l_name\t$l_firstname\t$l_domain_name\t\n"
                        ."2\tadmin1\tAdmin\tdomainezz.com\tzz.com\t\n"
                        ."3\tuser1\tDoe\tJohn\tzz.com\t\n"
                        ."4\tediteur1\tDoe\tJane\tzz.com\t\n"
                        ."6\tadmin2\tAdmin Lastname\tFirstname\tzz.com\t\n"
                        ,$mailData[0]['content']);
 }
Beispiel #2
0
  public function testModifyParticipationStateMail() {
    $event = OBM_EventFactory::getInstance()->getById(1);
    $users = $event->get('user');
    $resources = $event->get('resource');
    $user = $users[0];
    $res = $resources[0];

    $user->set('state', 'NEEDS-ACTION');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertEquals('Participation updated on OBM: Title',$mailData[0]['subject']);
    $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[0]['to']);
    $this->assertContains("NEEDS-ACTION",$mailData[0]['content']);

    $user->set('state', 'DECLINED');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertEquals('Participation updated on OBM: Title',$mailData[1]['subject']);
    $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[1]['to']);
    $this->assertContains("DECLINED",$mailData[1]['content']);  

    $user->set('state', 'ACCEPTED');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertNull($mailData[2]);

    $res->set('state', 'DECLINED');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertEquals('Resource participation updated on OBM: Title',$mailData[2]['subject']);
    $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[2]['to']);
    $this->assertContains("DECLINED",$mailData[2]['content']);  

    $res->set('state', 'NEEDS-ACTION');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertEquals('Resource participation updated on OBM: Title',$mailData[3]['subject']);
    $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[3]['to']);
    $this->assertContains("NEEDS-ACTION",$mailData[3]['content']);  

    $res->set('state', 'ACCEPTED');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertNull($mailData[4]);
  }
Beispiel #3
0
 public function testuserMailQuotaReportCommand() {
   global $l_id, $l_login, $l_lastname, $l_firstname, $l_mail_quota_use, $l_used_percent, $l_warn;
   ob_start();
   $cmd = new UserMailQuotaReportCommand();
   $cmd->doIt();
   $mailData = Stato_StaticTransport::getMailQ();
   $this->assertEquals('Rapport d\'exploitation : Utilisation espace mail',$mailData[0]['subject']);
   $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[0]['to']);
   $this->assertContains("Rapport d'exploitation du traitement \"Utilisation espace mail\" :\n"
                        ."\n"
                        ."$l_id\t$l_login\t$l_lastname\t$l_firstname\t$l_mail_quota_use\t$l_used_percent\t$l_warn\t\n"
                        ."1\tadmin0\tAdmin Lastname\tFirstname\t5\t50%\t\t\n"
                        ."5\tadmin2\tAdmin Lastname\tFirstname\t19\t95%\tAttention le quota est bientôt atteind\t\n"
                        ,$mailData[0]['content']);
   ob_clean();
   ob_end_flush();
 }