You are here

public function ConfigEntityTest::testReactionRuleSaving in Rules 8.3

Tests that a reaction rule config entity can be saved.

File

tests/src/Kernel/ConfigEntityTest.php, line 122

Class

ConfigEntityTest
Tests storage and loading of Rules config entities.

Namespace

Drupal\Tests\rules\Kernel

Code

public function testReactionRuleSaving() {

  // 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();
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('rules_reaction_rule');
  $config_entity = $storage
    ->create([
    'id' => 'test_rule',
  ])
    ->setExpression($rule);
  $config_entity
    ->save();
}