Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstallerMailer::installed #4090

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/bc-installer/src/Mailer/Admin/InstallerMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class InstallerMailer extends BcAdminMailer
* @param PasswordRequest|EntityInterface
* @checked
* @noTodo
* @unitTest
*/
public function installed(string $email)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* baserCMS : Based Website Development Project <https://basercms.net>
* Copyright (c) baserCMS Users Community <https://basercms.net/community/>
*
* @copyright Copyright (c) baserCMS Users Community
* @link https://basercms.net baserCMS Project
* @since baserCMS v 4.0.9
* @license https://basercms.net/license/index.html
*/

namespace BcInstaller\Test\TestCase\Mailer\Admin;
use BaserCore\Test\Factory\SiteConfigFactory;
use BaserCore\Test\Factory\SiteFactory;
use BaserCore\TestSuite\BcTestCase;
use BcInstaller\Mailer\Admin\InstallerMailer;
use Cake\TestSuite\EmailTrait;

/**
* Class InstallerMailerTest
*
* @property InstallerMailer $InstallerMailer
*/
class InstallerMailerTest extends BcTestCase
{

use EmailTrait;

/**
* setup
*/
public function setUp(): void
{
parent::setUp();
SiteConfigFactory::make(['name' => 'email', 'value' => '[email protected]'])->persist();
SiteFactory::make(['id' => 1, 'display_name' => 'main site'])->persist();

$this->InstallerMailer = new InstallerMailer();
}

/**
* tearDown
*
* @return void
*/
public function tearDown(): void
{
parent::tearDown();
}

/**
* beforeFilter
*/
public function testInstalled()
{
$this->InstallerMailer->installed('[email protected]');

//戻り値確認
$this->assertEquals(['[email protected]' => '[email protected]'], $this->InstallerMailer->getTo());
$vars = $this->InstallerMailer->viewBuilder()->getVars();
$this->assertEquals('[email protected]', $vars['email']);
$this->assertEquals('https://localhost/', $vars['siteUrl']);
$this->assertEquals('https://localhost/baser/admin/baser-core/users/login', $vars['adminUrl']);
}

}