public function VariableSetTest::testNonStringKey in Drupal 7 to 8/9 Module Upgrader 8
File
- tests/
src/ Unit/ Plugin/ DMU/ Converter/ Functions/ VariableSetTest.php, line 14
Class
- VariableSetTest
- @group DMU.Converter.Functions @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions\VariableSet
Namespace
Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Converter\FunctionsCode
public function testNonStringKey() {
$original = <<<'END'
<?php
variable_set($my_var, TRUE);
END;
$expected = <<<'END'
<?php
// @FIXME
// The correct configuration object could not be determined. You'll need to
// rewrite this call manually.
variable_set($my_var, TRUE);
END;
$snippet = Parser::parseSource($original);
$function_call = $snippet
->find(Filter::isFunctionCall('variable_set'))
->get(0);
$rewritten = $this->plugin
->rewrite($function_call, $this->target);
$this
->assertNull($rewritten);
$this
->assertSame($expected, $snippet
->getText());
}