diff --git a/plugins/bc-mail/src/Controller/Admin/MailContentsController.php b/plugins/bc-mail/src/Controller/Admin/MailContentsController.php index 75d4da3a1f..b7037715ae 100644 --- a/plugins/bc-mail/src/Controller/Admin/MailContentsController.php +++ b/plugins/bc-mail/src/Controller/Admin/MailContentsController.php @@ -55,6 +55,7 @@ public function initialize(): void * @param int ブログコンテンツID * @checked * @noTodo + * @unitTest */ public function edit(MailContentsAdminServiceInterface $service, int $id) { diff --git a/plugins/bc-mail/tests/TestCase/Controller/Admin/MailContentsControllerTest.php b/plugins/bc-mail/tests/TestCase/Controller/Admin/MailContentsControllerTest.php index d67bbbcb5c..37ef521504 100644 --- a/plugins/bc-mail/tests/TestCase/Controller/Admin/MailContentsControllerTest.php +++ b/plugins/bc-mail/tests/TestCase/Controller/Admin/MailContentsControllerTest.php @@ -12,7 +12,6 @@ namespace BcMail\Test\TestCase\Controller\Admin; -use BaserCore\Test\Factory\ContentFactory; use BaserCore\Test\Scenario\InitAppScenario; use BaserCore\TestSuite\BcTestCase; use BaserCore\Utility\BcContainerTrait; @@ -90,7 +89,23 @@ public function test_delete() */ public function testAdmin_edit() { - $this->markTestIncomplete('このテストは、まだ実装されていません。'); + $this->enableSecurityToken(); + $this->enableCsrfToken(); + //データーを生成 + $mailContentServices = $this->getService(MailContentsServiceInterface::class); + //データを生成 + $this->loadFixtureScenario(MailContentsScenario::class); + //Postデータを生成 + $mailContent = $mailContentServices->get(1); + $mailContent->description = 'this is api edit'; + //対象URLをコル + $this->post('/baser/admin/bc-mail/mail_contents/edit/1', $mailContent->toArray()); + $this->assertResponseCode(302); + $this->assertFlashMessage('メールフォーム「お問い合わせ」を更新しました。'); + + //エラーを発生した場合 + $this->post('/baser/admin/bc-mail/mail_contents/edit/222', $mailContent->toArray()); + $this->assertResponseCode(404); } /**