diff --git a/plugins/bc-installer/src/Service/InstallationsService.php b/plugins/bc-installer/src/Service/InstallationsService.php index 3ba40659c8..98813e8f28 100644 --- a/plugins/bc-installer/src/Service/InstallationsService.php +++ b/plugins/bc-installer/src/Service/InstallationsService.php @@ -586,6 +586,7 @@ public function getAllDefaultDataPatterns(): array * @param array $email * @checked * @noTodo + * @unitTest */ public function sendCompleteMail(array $postData) { diff --git a/plugins/bc-installer/tests/TestCase/Service/InstallationsServiceTest.php b/plugins/bc-installer/tests/TestCase/Service/InstallationsServiceTest.php index 1809750cc1..5df63389af 100644 --- a/plugins/bc-installer/tests/TestCase/Service/InstallationsServiceTest.php +++ b/plugins/bc-installer/tests/TestCase/Service/InstallationsServiceTest.php @@ -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; @@ -198,6 +199,23 @@ public function testTestConnectDb() $this->Installations->testConnectDb($config); } + /** + * test sendCompleteMail + */ + public function testSendCompleteMail() + { + //データを生成 + SiteConfigFactory::make(['name' => 'email', 'value' => 'basertest@example.com'])->persist(); + + //正常テスト + $this->Installations->sendCompleteMail(['admin_email' => 'abc@example.example']); + + //エラーを発生 + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('The email set for `to` is empty.'); + $this->Installations->sendCompleteMail(['admin_email' => '']); + } + /** * test setAdminEmail */