diff --git a/plugins/bc-mail/src/Model/Table/MailFieldsTable.php b/plugins/bc-mail/src/Model/Table/MailFieldsTable.php index 23c70eae4e..a5de9fdada 100755 --- a/plugins/bc-mail/src/Model/Table/MailFieldsTable.php +++ b/plugins/bc-mail/src/Model/Table/MailFieldsTable.php @@ -249,6 +249,7 @@ public function halfTextMailField(string $value) * @return bool * @checked * @noTodo + * @unitTest */ public function sourceMailField(string $value, array $context) { diff --git a/plugins/bc-mail/tests/TestCase/Model/Table/MailFieldsTableTest.php b/plugins/bc-mail/tests/TestCase/Model/Table/MailFieldsTableTest.php index b2c754f59d..1664de4fd7 100755 --- a/plugins/bc-mail/tests/TestCase/Model/Table/MailFieldsTableTest.php +++ b/plugins/bc-mail/tests/TestCase/Model/Table/MailFieldsTableTest.php @@ -189,12 +189,30 @@ public function testHalfTextMailField() /** * 選択リストの入力チェック + * @dataProvider sourceMailFieldDataProvider */ - public function testSourceMailField() + public function test_sourceMailField($value, $context, $expected) { - $this->markTestIncomplete('このテストは、まだ実装されていません。'); + $result = $this->MailFieldsTable->sourceMailField($value, $context); + $this->assertEquals($expected, $result); + } + + public static function sourceMailFieldDataProvider() + { + return [ + ['radio', ['data' => ['type' => 'radio']], true], + ['', ['data' => ['type' => 'radio']], false], + ['select', ['data' => ['type' => 'select']], true], + ['', ['data' => ['type' => 'select']], false], + ['multi_check', ['data' => ['type' => 'multi_check']], true], + ['', ['data' => ['type' => 'multi_check']], false], + ['autozip', ['data' => ['type' => 'autozip']], true], + ['', ['data' => ['type' => 'autozip']], false], + ['text', ['data' => ['type' => 'text']], true] + ]; } + /** * フィールドデータをコピーする *