2019-06-17 02:29:19 +05:30
|
|
|
<?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;
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
final class ChangeEmailTest extends TestCase {
|
2019-06-17 02:29:19 +05:30
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
private ChangeEmail $template;
|
2019-06-17 02:29:19 +05:30
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function testParams(): void {
|
2019-06-17 02:29:19 +05:30
|
|
|
$this->template->setKey('mock-key');
|
|
|
|
$params = $this->template->getParams();
|
|
|
|
$this->assertSame('mock-key', $params['key']);
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function testInvalidCallOfParams(): void {
|
2019-06-17 02:29:19 +05:30
|
|
|
$this->expectException(InvalidCallException::class);
|
|
|
|
$this->template->getParams();
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
protected function _before(): void {
|
2019-06-17 02:29:19 +05:30
|
|
|
parent::_before();
|
|
|
|
/** @var MailerInterface|\PHPUnit\Framework\MockObject\MockObject $mailer */
|
|
|
|
$mailer = $this->createMock(MailerInterface::class);
|
|
|
|
$this->template = new ChangeEmail($mailer);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|