You are here

public function ExpressionSerializationTest::testActionExpressionSerialization in Rules 8.3

Tests serializing action expressions.

File

tests/src/Unit/Integration/Engine/ExpressionSerializationTest.php, line 19

Class

ExpressionSerializationTest
Tests serializing expression objects.

Namespace

Drupal\Tests\rules\Unit\Integration\Engine

Code

public function testActionExpressionSerialization() {
  $action = $this->rulesExpressionManager
    ->createAction('rules_test_string', ContextConfig::create()
    ->setValue('text', 'test'));
  $serialized_expression = serialize($action);
  $action = unserialize($serialized_expression);
  $result = RulesComponent::create($action)
    ->provideContext('concatenated')
    ->execute();
  $this
    ->assertSame('testtest', $result['concatenated']);
}