3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Converter\Functions;
8 * @group DMU.Converter.Functions
9 * @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions\CToolsObjectCacheSet
11 class CToolsObjectCacheSetTest extends FunctionCallModifierTestBase {
13 public function testRewriteNoSessionID() {
14 $function_call = Parser::parseExpression('ctools_object_cache_set("foo", "baz", array())');
15 $rewritten = $this->plugin->rewrite($function_call, $this->target);
16 $this->assertInstanceOf('\Pharborist\Objects\ObjectMethodCallNode', $rewritten);
17 $this->assertEquals('\Drupal::service(\'user.tempstore\')->set("baz", array())', $rewritten->getText());
20 public function testRewriteSessionID() {
21 $function_call = Parser::parseExpression('ctools_object_cache_set("foo", "baz", array(), "SESSION_ID")');
22 $rewritten = $this->plugin->rewrite($function_call, $this->target);
23 $this->assertInstanceOf('\Pharborist\Objects\ObjectMethodCallNode', $rewritten);
24 $this->assertEquals('\Drupal::service(\'user.tempstore\')->set("baz", array())', $rewritten->getText());