Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MailformHelper::getGroupValidErrors #4066

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/bc-mail/src/View/Helper/MailformHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
23 changes: 23 additions & 0 deletions plugins/bc-mail/tests/TestCase/View/Helper/MailformHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand 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);
}
}