You are here

public function FormStateTest::testRewriteKnownPropertyAsGetter in Drupal 7 to 8/9 Module Upgrader 8

File

tests/src/Unit/Plugin/DMU/Rewriter/FormStateTest.php, line 50

Class

FormStateTest
@group DMU.Rewriter @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Rewriter\FormState

Namespace

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

Code

public function testRewriteKnownPropertyAsGetter() {
  $expr = Parser::parseExpression('$form_state["input"]');
  $rewritten = $this->plugin
    ->rewriteAsGetter($expr, 'input');
  $this
    ->assertInstanceOf('\\Pharborist\\Objects\\ObjectMethodCallNode', $rewritten);
  $this
    ->assertEquals('$form_state->getUserInput()', $rewritten
    ->getText());
}