Skip to content

Commit 3076318

Browse files
committed
Fixed contact form tests
1 parent e38c34a commit 3076318

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/unit/models/ContactFormTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace tests\unit\models;
44

5+
use app\models\ContactForm;
6+
use yii\mail\MessageInterface;
7+
58
class ContactFormTest extends \Codeception\Test\Unit
69
{
710
private $model;
@@ -19,7 +22,7 @@ public function testEmailIsSentOnContact()
1922

2023
$this->model->expects($this->once())
2124
->method('validate')
22-
->will($this->returnValue(true));
25+
->willReturn(true);
2326

2427
$this->model->attributes = [
2528
'name' => 'Tester',
@@ -33,10 +36,12 @@ public function testEmailIsSentOnContact()
3336
// using Yii2 module actions to check email was sent
3437
$this->tester->seeEmailIsSent();
3538

39+
/** @var MessageInterface $emailMessage */
3640
$emailMessage = $this->tester->grabLastSentEmail();
3741
expect('valid email is sent', $emailMessage)->isInstanceOf('yii\mail\MessageInterface');
3842
expect($emailMessage->getTo())->hasKey('[email protected]');
39-
expect($emailMessage->getFrom())->hasKey('[email protected]');
43+
expect($emailMessage->getFrom())->hasKey('[email protected]');
44+
expect($emailMessage->getReplyTo())->hasKey('[email protected]');
4045
expect($emailMessage->getSubject())->equals('very important letter subject');
4146
expect($emailMessage->toString())->contains('body of current message');
4247
}

0 commit comments

Comments
 (0)