public function FormStateTest::testRewriteArbitraryKeyAsGetter in Drupal 7 to 8/9 Module Upgrader 8
File
- tests/
src/ Unit/ Plugin/ DMU/ Rewriter/ FormStateTest.php, line 57
Class
- FormStateTest
- @group DMU.Rewriter @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Rewriter\FormState
Namespace
Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\RewriterCode
public function testRewriteArbitraryKeyAsGetter() {
$expr = Parser::parseExpression('$form_state["foo"]["baz"]');
$rewritten = $this->plugin
->rewriteAsGetter($expr, 'foo');
$this
->assertInstanceOf('\\Pharborist\\Objects\\ObjectMethodCallNode', $rewritten);
$this
->assertEquals('$form_state->get(["foo", "baz"])', $rewritten
->getText());
}