function ExpressionSerializationTest::testActionExpressionSerialization

Tests serializing action expressions.

File

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

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