public function CategoryCreationTrait::createCategory in Mass Contact 8
Creates a category.
Return value
\Drupal\mass_contact\Entity\MassContactCategoryInterface The new category entity.
6 calls to CategoryCreationTrait::createCategory()
- CategoryAccessControlHandlerTest::testViewAccess in tests/
src/ Kernel/ CategoryAccessControlHandlerTest.php - Tests view access.
- MassContactCategoryTest::testCrud in tests/
src/ Kernel/ Entity/ MassContactCategoryTest.php - Test CRUD operations.
- MassContactFormTest::setUp in tests/
src/ Functional/ Form/ MassContactFormTest.php - MassContactTest::testQueueRecipients in tests/
src/ Kernel/ MassContactTest.php - Tests the send me a copy functionality.
- OptOutTest::setUp in tests/
src/ Kernel/ OptOutTest.php
File
- tests/
src/ Kernel/ CategoryCreationTrait.php, line 19
Class
- CategoryCreationTrait
- Helper methods to create mass contact categories for testing.
Namespace
Drupal\Tests\mass_contact\KernelCode
public function createCategory(array $settings = []) {
$settings += [
'id' => mb_strtolower($this
->randomMachineName()),
'label' => $this
->randomString(),
'recipients' => [],
'selected' => FALSE,
];
$category = MassContactCategory::create($settings);
$category
->save();
return $category;
}