diff --git a/plugins/bc-mail/src/Controller/Api/MailMessagesController.php b/plugins/bc-mail/src/Controller/Api/MailMessagesController.php index 6f8fcc0257..a7485bdc00 100644 --- a/plugins/bc-mail/src/Controller/Api/MailMessagesController.php +++ b/plugins/bc-mail/src/Controller/Api/MailMessagesController.php @@ -36,6 +36,7 @@ class MailMessagesController extends BcApiController * @return \Cake\Http\Response|void * @checked * @noTodo + * @unitTest */ public function beforeFilter(EventInterface $event) { diff --git a/plugins/bc-mail/tests/TestCase/Controller/Api/Admin/MailMessagesControllerTest.php b/plugins/bc-mail/tests/TestCase/Controller/Api/Admin/MailMessagesControllerTest.php index 99f9a1c342..71b6758e2b 100644 --- a/plugins/bc-mail/tests/TestCase/Controller/Api/Admin/MailMessagesControllerTest.php +++ b/plugins/bc-mail/tests/TestCase/Controller/Api/Admin/MailMessagesControllerTest.php @@ -15,9 +15,11 @@ use BaserCore\Test\Factory\ContentFactory; use BaserCore\Test\Scenario\InitAppScenario; use BaserCore\TestSuite\BcTestCase; +use BcMail\Controller\Api\MailMessagesController; use BcMail\Service\MailMessagesServiceInterface; use BcMail\Test\Factory\MailContentFactory; use BcMail\Test\Scenario\MailContentsScenario; +use Cake\Event\Event; use Cake\ORM\Entity; use Cake\ORM\TableRegistry; use Cake\TestSuite\IntegrationTestTrait; @@ -56,6 +58,19 @@ public function tearDown(): void parent::tearDown(); } + + /** + * test beforeFilter + */ + public function testBeforeFilter() + { + $this->MailMessagesController = new MailMessagesController($this->getRequest()); + $event = new Event('Controller.beforeFilter', $this->MailMessagesController); + $this->MailMessagesController->beforeFilter($event); + $config = $this->MailMessagesController->FormProtection->getConfig('validate'); + $this->assertFalse($config); + } + /** * [API] 受信メール一覧 */