class RendererLegacyTest

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Render/RendererLegacyTest.php \Drupal\KernelTests\Core\Render\RendererLegacyTest
  2. 11.x core/tests/Drupal/KernelTests/Core/Render/RendererLegacyTest.php \Drupal\KernelTests\Core\Render\RendererLegacyTest

Deprecation tests cases for the render layer.

Attributes

#[Group('legacy')] #[RunTestsInSeparateProcesses] #[IgnoreDeprecations]

Hierarchy

Expanded class hierarchy of RendererLegacyTest

File

core/tests/Drupal/KernelTests/Core/Render/RendererLegacyTest.php, line 16

Namespace

Drupal\KernelTests\Core\Render
View source
class RendererLegacyTest extends KernelTestBase {
  
  /**
   * Tests deprecation of drupal_attach_tabledrag().
   *
   * @see drupal_attach_tabledrag()
   */
  public function testTableDrag() : void {
    $this->expectUserDeprecationMessage('drupal_attach_tabledrag() is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use \\Drupal\\Core\\Render\\Element\\Table::attachTabledrag() instead. See https://www.drupal.org/node/3035565');
    $elements = [];
    $options = [
      'table_id' => 'test-table',
      'action' => 'match',
      'relationship' => 'sibling',
      'group' => 'test',
    ];
    drupal_attach_tabledrag($elements, $options);
    $expected = [];
    Table::attachTabledrag($expected, $options);
    $this->assertSame($expected['#attached']['drupalSettings']['tableDrag']['test-table']['test'][1], $elements['#attached']['drupalSettings']['tableDrag']['test-table']['test'][0]);
  }

}

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