diff --git a/plugins/bc-mail/src/View/Helper/MailformHelper.php b/plugins/bc-mail/src/View/Helper/MailformHelper.php index 7a62a1aa6a..45b04a688e 100755 --- a/plugins/bc-mail/src/View/Helper/MailformHelper.php +++ b/plugins/bc-mail/src/View/Helper/MailformHelper.php @@ -306,6 +306,7 @@ public function authCaptcha(string $fieldName, array $options = []) * @return array * @checked * @noTodo + * @unitTest */ public function getGroupValidErrors(ResultSetInterface $mailFields, string $groupValid, array $options = [], bool $distinct = true) { diff --git a/plugins/bc-mail/tests/TestCase/View/Helper/MailformHelperTest.php b/plugins/bc-mail/tests/TestCase/View/Helper/MailformHelperTest.php index 2411cabb90..285332f5e9 100644 --- a/plugins/bc-mail/tests/TestCase/View/Helper/MailformHelperTest.php +++ b/plugins/bc-mail/tests/TestCase/View/Helper/MailformHelperTest.php @@ -13,12 +13,20 @@ use BaserCore\TestSuite\BcTestCase; use BcMail\Model\Entity\MailField; use BcMail\Test\Factory\MailMessagesFactory; +use BcMail\Service\MailFieldsServiceInterface; use BcMail\View\Helper\MailformHelper; +use BcMail\Test\Scenario\MailContentsScenario; +use BcMail\Test\Scenario\MailFieldsScenario; use Cake\ORM\ResultSet; use Cake\View\View; +use CakephpFixtureFactories\Scenario\ScenarioAwareTrait; class MailformHelperTest extends BcTestCase { + /** + * ScenarioAwareTrait + */ + use ScenarioAwareTrait; /** * set up @@ -97,4 +105,19 @@ public static function isGroupLastFieldProvider() [[['group_field' => 'group1'], ['group_field' => 'group2']], 0, true], ]; } + + /** + * test getGroupValidErrors + */ + public function testGetGroupValidErrors() + { + // prepare + $this->loadFixtureScenario(MailContentsScenario::class); + $this->loadFixtureScenario(MailFieldsScenario::class); + $MailFieldsService = $this->getService(MailFieldsServiceInterface::class); + // get mail field list + $mailFields = $MailFieldsService->getIndex(1)->all(); + $rs = $this->MailformHelper->getGroupValidErrors($mailFields, 'field_name'); + $this->assertEquals([], $rs); + } }