function AjaxCommandsTest::testStringAddCssCommand

@covers \Drupal\Core\Ajax\AddCssCommand
@group legacy

File

core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php, line 133

Class

AjaxCommandsTest
Test coverage for various classes in the \Drupal\Core\Ajax namespace.

Namespace

Drupal\Tests\Core\Ajax

Code

public function testStringAddCssCommand() : void {
  $this->expectDeprecation("The Drupal\\Core\\Ajax\\AddCssCommand with a string argument is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. See http://www.drupal.org/node/3154948");
  $command = new AddCssCommand('<style>p{ text-decoration:blink; }</style>');
  $expected = [
    'command' => 'add_css',
    'data' => '<style>p{ text-decoration:blink; }</style>',
  ];
  $this->assertEquals($expected, $command->render());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.