public function MassContactCategoryTest::testCrud in Mass Contact 8
Test CRUD operations.
@covers ::setRecipients @covers ::getRecipients @covers ::getGroupingCategories
File
- tests/
src/ Kernel/ Entity/ MassContactCategoryTest.php, line 47
Class
- MassContactCategoryTest
- Kernel tests for the mass contact category entity.
Namespace
Drupal\Tests\mass_contact\Kernel\EntityCode
public function testCrud() {
$category = $this
->createCategory();
$grouping = $category
->getGroupingCategories('role');
$this
->assertFalse($grouping);
$recipients = [
'role' => [
'categories' => [
'foo',
'bar',
],
'conjunction' => 'AND',
],
];
$category
->setRecipients($recipients);
$this
->assertEquals($recipients, $category
->getRecipients());
$this
->assertFalse($category
->getGroupingCategories('foo'));
$grouping = $category
->getGroupingCategories('role');
$this
->assertEquals([
'foo',
'bar',
], $grouping
->getCategories());
$this
->assertEquals('Roles: <em class="placeholder">Foo, Bar</em>', $grouping
->displayCategories([
'foo',
'bar',
]));
}