public function GenericTest::testRewriteValidPropertyAsSetter in Drupal 7 to 8/9 Module Upgrader 8
File
- tests/
src/ Unit/ Plugin/ DMU/ Rewriter/ GenericTest.php, line 52
Class
- GenericTest
- @group DMU.Rewriter @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Rewriter\Generic
Namespace
Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\RewriterCode
public function testRewriteValidPropertyAsSetter() {
/** @var \Pharborist\Operators\AssignNode $expr */
$expr = Parser::parseExpression('$node->title = "Foobaz"');
$rewritten = $this->plugin
->rewriteAsSetter($expr
->getLeftOperand(), 'title', $expr);
$this
->assertInstanceOf('\\Pharborist\\Objects\\ObjectMethodCallNode', $rewritten);
$this
->assertEquals('$node->setTitle("Foobaz")', $rewritten
->getText());
}