You are here

public function ConfigSchemaTest::testMailActionContextSchema in Rules 8.3

Make sure the system send email config schema works on saving.

File

tests/src/Kernel/ConfigSchemaTest.php, line 33

Class

ConfigSchemaTest
Tests that action specific config schema works.

Namespace

Drupal\Tests\rules\Kernel

Code

public function testMailActionContextSchema() {

  // This test does not perform assertions, and the @doesNotPerformAssertions
  // annotation does not work properly in DrupalCI for PHP 7.4.
  // @see https://www.drupal.org/project/rules/issues/3179763
  $this
    ->addToAssertionCount(1);
  $rule = $this->expressionManager
    ->createRule();
  $rule
    ->addAction('rules_send_email', ContextConfig::create()
    ->setValue('to', [
    'test@example.com',
  ])
    ->setValue('message', 'mail body')
    ->setValue('subject', 'test subject'));
  $config_entity = $this->storage
    ->create([
    'id' => 'test_rule',
  ])
    ->setExpression($rule);
  $config_entity
    ->save();
}