mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Refactor emails models objects, rework related tests
This commit is contained in:
36
common/tests/unit/emails/templates/ChangeEmailTest.php
Normal file
36
common/tests/unit/emails/templates/ChangeEmailTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace common\tests\unit\emails\templates;
|
||||
|
||||
use common\emails\templates\ChangeEmail;
|
||||
use common\tests\unit\TestCase;
|
||||
use yii\base\InvalidCallException;
|
||||
use yii\mail\MailerInterface;
|
||||
|
||||
class ChangeEmailTest extends TestCase {
|
||||
|
||||
/**
|
||||
* @var ChangeEmail()|\PHPUnit\Framework\MockObject\MockObject
|
||||
*/
|
||||
private $template;
|
||||
|
||||
public function testParams() {
|
||||
$this->template->setKey('mock-key');
|
||||
$params = $this->template->getParams();
|
||||
$this->assertSame('mock-key', $params['key']);
|
||||
}
|
||||
|
||||
public function testInvalidCallOfParams() {
|
||||
$this->expectException(InvalidCallException::class);
|
||||
$this->template->getParams();
|
||||
}
|
||||
|
||||
protected function _before() {
|
||||
parent::_before();
|
||||
/** @var MailerInterface|\PHPUnit\Framework\MockObject\MockObject $mailer */
|
||||
$mailer = $this->createMock(MailerInterface::class);
|
||||
$this->template = new ChangeEmail($mailer);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user