public function VariableGetTest::testForeignStringKey in Drupal 7 to 8/9 Module Upgrader 8
File
- tests/
src/ Unit/ Plugin/ DMU/ Converter/ Functions/ VariableGetTest.php, line 34
Class
- VariableGetTest
- @group DMU.Converter.Functions @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions\VariableGet
Namespace
Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Converter\FunctionsCode
public function testForeignStringKey() {
$original = <<<'END'
<?php
variable_get('bar_wambooli', TRUE);
END;
$expected = <<<'END'
<?php
// @FIXME
// This looks like another module's variable. You'll need to rewrite this call
// to ensure that it uses the correct configuration object.
variable_get('bar_wambooli', TRUE);
END;
$snippet = Parser::parseSource($original);
$function_call = $snippet
->find(Filter::isFunctionCall('variable_get'))
->get(0);
$rewritten = $this->plugin
->rewrite($function_call, $this->target);
$this
->assertNull($rewritten);
$this
->assertSame($expected, $snippet
->getText());
}