public function FormStateTest::testRewriteKnownPropertyAsSetter in Drupal 7 to 8/9 Module Upgrader 8
File
- tests/
src/ Unit/ Plugin/ DMU/ Rewriter/ FormStateTest.php, line 77
Class
- FormStateTest
- @group DMU.Rewriter @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Rewriter\FormState
Namespace
Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\RewriterCode
public function testRewriteKnownPropertyAsSetter() {
/** @var \Pharborist\Operators\AssignNode $expr */
$expr = Parser::parseExpression('$form_state["input"] = array()');
$rewritten = $this->plugin
->rewriteAsSetter($expr
->getLeftOperand(), 'input', $expr);
$this
->assertInstanceOf('\\Pharborist\\Objects\\ObjectMethodCallNode', $rewritten);
$this
->assertEquals('$form_state->setUserInput(array())', $rewritten
->getText());
}