You are here

public function VariableDelTest::testForeignStringKey in Drupal 7 to 8/9 Module Upgrader 8

File

tests/src/Unit/Plugin/DMU/Converter/Functions/VariableDelTest.php, line 34

Class

VariableDelTest
@group DMU.Converter.Functions @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions\VariableDel

Namespace

Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Converter\Functions

Code

public function testForeignStringKey() {
  $original = <<<'END'
<?php
variable_del('bar_wambooli');
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_del('bar_wambooli');
END;
  $snippet = Parser::parseSource($original);
  $function_call = $snippet
    ->find(Filter::isFunctionCall('variable_del'))
    ->get(0);
  $rewritten = $this->plugin
    ->rewrite($function_call, $this->target);
  $this
    ->assertNull($rewritten);
  $this
    ->assertSame($expected, $snippet
    ->getText());
}