You are here

public function ExpressionSerializationTest::testActionContainerExpressionSerialization in Rules 8.3

Tests action container base class serialization.

File

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

Class

ExpressionSerializationTest
Tests serializing expression objects.

Namespace

Drupal\Tests\rules\Unit\Integration\Engine

Code

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