You are here

protected function EasyEmailTestBase::createTemplate in Easy Email 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/EasyEmailTestBase.php \Drupal\Tests\easy_email\Functional\EasyEmailTestBase::createTemplate()

Parameters

array $values:

bool $save:

Return value

\Drupal\easy_email\Entity\EasyEmailTypeInterface

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

\Drupal\Core\Entity\EntityStorageException

40 calls to EasyEmailTestBase::createTemplate()
EasyEmailSendTest::testSaveWithoutSend in tests/src/Functional/EasyEmailSendTest.php
Tests email saving without sending.
EasyEmailSendTest::testSendDuplicateCheck in tests/src/Functional/EasyEmailSendTest.php
Tests email sending with a unique key to prevent duplicates
EasyEmailSendTest::testSendHtmlAndPlainText in tests/src/Functional/EasyEmailSendTest.php
Tests sending email with an HTML and Plain Text version
EasyEmailSendTest::testSendHtmlGeneratePlainText in tests/src/Functional/EasyEmailSendTest.php
Tests email sending with plain text version generated from HTML version
EasyEmailSendTest::testSendHtmlOnly in tests/src/Functional/EasyEmailSendTest.php
Tests email sending with HTML version only

... See full list

File

tests/src/Functional/EasyEmailTestBase.php, line 110

Class

EasyEmailTestBase
Class EasyEmailTestBase

Namespace

Drupal\Tests\easy_email\Functional

Code

protected function createTemplate($values = [], $save = TRUE) {

  /** @var \Drupal\Core\Entity\EntityStorageInterface $email_template_storage */
  $email_template_storage = \Drupal::entityTypeManager()
    ->getStorage('easy_email_type');
  $template = $email_template_storage
    ->create($values);
  if ($save) {
    $template
      ->save();
  }
  return $template;
}