public function OptOutTest::testOptOutCategory in Mass Contact 8
Tests per-category opt-out.
File
- tests/
src/ Kernel/ OptOutTest.php, line 141
Class
- OptOutTest
- Kernel tests for the opt-out service.
Namespace
Drupal\Tests\mass_contact\KernelCode
public function testOptOutCategory() {
$this
->config('mass_contact.settings')
->set('optout_enabled', MassContactInterface::OPT_OUT_CATEGORY)
->save();
/** @var \Drupal\mass_contact\OptOutInterface $opt_out */
$opt_out = \Drupal::service('mass_contact.opt_out');
// Check category 1 and 3.
$expected = array_merge(array_keys($this->globalOptOut), array_keys($this->categoryOptOut1));
$expected = array_combine($expected, $expected);
$this
->assertEquals($expected, $opt_out
->getOptOutAccounts([
$this->categories[1],
$this->categories[3],
]));
}