You are here

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

File

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

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 testNonStringKey() {
  $original = <<<'END'
<?php
variable_del($my_var);
END;
  $expected = <<<'END'
<?php
// @FIXME
// The correct configuration object could not be determined. You'll need to
// rewrite this call manually.
variable_del($my_var);
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());
}