/** * @expectedException \rmrevin\yii\postman\LetterException */ public function testNotInitMailerException() { $NewLetter = new postman\models\LetterModel(); $NewLetter->sendImmediately(); }
/** * @depends testMain * @param \rmrevin\yii\postman\ViewLetter $Letter * @throws \rmrevin\yii\postman\Exception */ public function testSendSMTP(postman\ViewLetter $Letter) { $Postman = \rmrevin\yii\postman\Component::get(); $Postman->driver = 'smtp'; $Postman->reconfigureDriver(); $Letter->setSubject('SMTP html letter'); $this->assertInternalType('integer', $Letter->send()); $this->assertInternalType('integer', $Letter->send(true)); $this->assertEmpty($Letter->getLastError(), $Letter->getLastError()); $count = postman\models\LetterModel::find()->where(['subject' => 'SMTP html letter'])->count(); $this->assertEquals(2, $count); }