function AjaxCommandsTest::testOpenDialogCommandClass

Tests dialogClass for OpenDialogCommand and OpenOffCanvasDialogCommand.

This is a regression test for https://www.drupal.org/node/3474018.

@legacy-covers \Drupal\Core\Ajax\OpenDialogCommand @legacy-covers \Drupal\Core\Ajax\OpenOffCanvasDialogCommand

Attributes

#[Group('legacy')] #[DataProvider('dialogCommandProvider')]

File

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

Class

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

Namespace

Drupal\Tests\Core\Ajax

Code

public function testOpenDialogCommandClass(string $class, array $args, array $expected) : void {
  $short = (new \ReflectionClass($class))->getShortName();
  $this->expectDeprecation("Passing \$dialog_options['dialogClass'] to {$short}::__construct() is deprecated in drupal:10.3.0 and will be removed in drupal:12.0.0. Use \$dialog_options['classes'] instead. See https://www.drupal.org/node/3440844");
  $reflection = new \ReflectionClass($class);
  $command = $reflection->newInstanceArgs($args);
  $this->assertEquals($expected, $command->getDialogOptions());
}

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