示例#1
0
 public function testErrorCronSending()
 {
     $Postman = \rmrevin\yii\postman\Component::get();
     $Mailer = $Postman->getMailerObject();
     $Mailer->IsSMTP();
     $Letter = (new postman\RawLetter())->setSubject('Test error cron sending')->setBody('body')->setFrom(['*****@*****.**', 'Test'])->addAddress(\Yii::$app->params['demo_email'], ['*****@*****.**'], ['*****@*****.**'], ['*****@*****.**']);
     $Letter->send();
     $Letter->send();
     $Letter->send();
     $Letter->send();
     $Letter->send();
     $count = postman\models\LetterModel::find()->where(['date_send' => null])->count();
     $this->assertEquals(5, $count);
     $this->expectException('yii\\base\\Exception');
     postman\models\LetterModel::cron(1);
 }
示例#2
0
 public function testErrorCronSending()
 {
     $Postman = \rmrevin\yii\postman\Component::get();
     $Mailer = $Postman->getMailerObject();
     $Mailer->IsSMTP();
     $Mailer->Host = 'smtp.google.com';
     $Mailer->Username = '******';
     $Letter = (new postman\RawLetter())->setSubject('Test cron sending')->setBody('body')->setFrom(['*****@*****.**', 'Test'])->addAddress(\Yii::$app->params['demo_email'], ['*****@*****.**'], ['*****@*****.**'], ['*****@*****.**']);
     $Letter->send();
     $Letter->send();
     $Letter->send();
     $Letter->send();
     $Letter->send();
     $count = postman\models\LetterModel::find()->where(['date_send' => null])->count();
     $this->assertEquals(5, $count);
     postman\models\LetterModel::cron(1);
     $this->expectOutputString('The following From address failed: test@domain.com : Called Mail() without being connected' . "\n");
 }