You are here

public function GenericTest::testRewriteValidPropertyAsGetter in Drupal 7 to 8/9 Module Upgrader 8

File

tests/src/Unit/Plugin/DMU/Rewriter/GenericTest.php, line 37

Class

GenericTest
@group DMU.Rewriter @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Rewriter\Generic

Namespace

Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Rewriter

Code

public function testRewriteValidPropertyAsGetter() {

  /** @var \Pharborist\Objects\ObjectPropertyNode $expr */
  $expr = Parser::parseExpression('$node->nid');
  $rewritten = $this->plugin
    ->rewriteAsGetter($expr, 'nid');
  $this
    ->assertInstanceOf('\\Pharborist\\Objects\\ObjectMethodCallNode', $rewritten);
  $this
    ->assertEquals('$node->id()', $rewritten
    ->getText());
}