You are here

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

File

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

Class

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

Namespace

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

Code

public function testRewriteInvalidPropertyAsSetter() {

  /** @var \Pharborist\Operators\AssignNode $expr */
  $expr = Parser::parseExpression('$node->baz = "Blorf!"');
  $rewritten = $this->plugin
    ->rewriteAsSetter($expr
    ->getLeftOperand(), 'baz', $expr);
  $this
    ->assertNull($rewritten);

  /** @var \Pharborist\Operators\AssignNode $expr */
  $expr = Parser::parseExpression('$node->nid = 30');
  $rewritten = $this->plugin
    ->rewriteAsSetter($expr
    ->getLeftOperand(), 'nid', $expr);
  $this
    ->assertNull($rewritten);
}