function ExpressionSerializationTest::testActionContainerExpressionSerialization

Tests action container base class serialization.

File

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

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);
    // @phpcs:ignore DrupalPractice.FunctionCalls.InsecureUnserialize.InsecureUnserialize
    $expression = unserialize($serialized_expression);
    $result = RulesComponent::create($expression)->provideContext('concatenated')
        ->execute();
    $this->assertSame('testtest', $result['concatenated']);
}