public function GenericTest::testRewriteIsset in Drupal 7 to 8/9 Module Upgrader 8
File
- tests/
src/ Unit/ Plugin/ DMU/ Rewriter/ GenericTest.php, line 120
Class
- GenericTest
- @group DMU.Rewriter @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Rewriter\Generic
Namespace
Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\RewriterCode
public function testRewriteIsset() {
$code = <<<'END'
function foo($baz) {
if (isset($baz->title)) {
}
}
END;
/** @var \Pharborist\Functions\FunctionDeclarationNode $func */
$func = Parser::parseSnippet($code);
$this->plugin
->rewrite($func
->getParameterAtIndex(0));
$expected = <<<'END'
function foo($baz) {
if (!$baz->getTitle()) {
}
}
END;
$this
->assertEquals($expected, $func
->getText());
}