示例#1
0
 function testGetFilesystemPathWithSlashAtTheEnd()
 {
     $GLOBALS['sys_pluginsroot'] = '/my/application/';
     $pm = new MockPluginManager($this);
     $pm->setReturnValue('getNameForPlugin', 'zataz');
     $pm->setReturnValue('pluginIsCustom', false);
     $p = new PluginTestVersion($this);
     $p->setReturnValue('_getPluginManager', $pm);
     $this->assertEqual($p->getFilesystemPath(), '/my/application/zataz');
 }
 function testSendMailToSDFailure()
 {
     $um = new MockUserManager();
     $user = mock('PFUser');
     $um->setReturnValue('getCurrentUser', $user);
     $validParams = array('ticket_id' => 'QA0000000000001', 'summary' => 'valid summary', 'description' => 'valid description', 'type' => 1, 'text_type' => 'ASSISTANCE REQUEST', 'severity' => 1, 'text_severity' => 'Minor', 'cc' => '*****@*****.**');
     $GLOBALS['Language']->setReturnValue('getText', 'Generic subject to SD', array('plugin_requesthelp', 'requesthelp_mail_subject', array('Minor', 'valid summary')));
     $requesthelp_user_mail_content = 'this is fake body';
     $requesthelp_mail_content = 'this is fake body';
     $requesthelp_Failure_mail_content = 'this is fake body';
     $pm = new MockPluginManager();
     $p = new MockProperties();
     $pm->setReturnValue('getPluginByName', $p);
     $p->setReturnValue('getProperty', '*****@*****.**');
     $actions = new RequestHelpActionsTestVersion3();
     $actions->setReturnValue('_getUserManager', $um);
     $actions->setReturnValue('_getPluginManager', $pm);
     $mail = new MockCodendi_Mail();
     $mail->expect('setTo', array('*****@*****.**'));
     $mail->expect('setSubject', array('Generic subject to SD'));
     $mail->expectOnce('setBodyHtml');
     $mail->setReturnValue('send', false);
     $actions->setReturnValue('_getCodendiMail', $mail);
     $this->assertFalse($actions->sendMail($validParams));
 }