Skip to content

Commit

Permalink
Merge pull request #3939 from HungDV2022/unitest_InstallationsService…
Browse files Browse the repository at this point in the history
…_sendCompleteMail

InstallationsService::sendCompleteMail() のユニットテスト
  • Loading branch information
HungDV2022 authored Oct 24, 2024
2 parents be2e452 + 83fdd1f commit 24c05e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/bc-installer/src/Service/InstallationsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ public function getAllDefaultDataPatterns(): array
* @param array $email
* @checked
* @noTodo
* @unitTest
*/
public function sendCompleteMail(array $postData)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use BaserCore\Service\PermissionGroupsServiceInterface;
use BaserCore\Test\Factory\ContentFactory;
use BaserCore\Test\Factory\ContentFolderFactory;
use BaserCore\Test\Factory\SiteConfigFactory;
use BaserCore\Test\Factory\SiteFactory;
use BaserCore\Test\Scenario\InitAppScenario;
use BaserCore\TestSuite\BcTestCase;
Expand Down Expand Up @@ -198,6 +199,23 @@ public function testTestConnectDb()
$this->Installations->testConnectDb($config);
}

/**
* test sendCompleteMail
*/
public function testSendCompleteMail()
{
//データを生成
SiteConfigFactory::make(['name' => 'email', 'value' => '[email protected]'])->persist();

//正常テスト
$this->Installations->sendCompleteMail(['admin_email' => '[email protected]']);

//エラーを発生
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The email set for `to` is empty.');
$this->Installations->sendCompleteMail(['admin_email' => '']);
}

/**
* test setAdminEmail
*/
Expand Down

0 comments on commit 24c05e1

Please sign in to comment.