drupalLogin($this->drupalCreateUser()); $this->drupalGet('test-page'); // Check that we can read the JS settings. $js_settings = $this->getDrupalSettings(); $this->assertSame('azAZ09();.,\\\/-_{}', $js_settings['test-setting']); // Dynamically change the setting using Javascript. $script = <<getSession()->evaluateScript($script); // Check that the setting has been changed. $js_settings = $this->getDrupalSettings(); $this->assertSame('foo', $js_settings['test-setting']); } }