function UrlTest::testToRenderArray

Tests deprecation of toRenderArray() method.

@covers ::toRenderArray @group legacy

File

core/tests/Drupal/Tests/Core/UrlTest.php, line 526

Class

UrlTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Url.php/class/Url/10" title="Defines an object that holds information about a URL." class="local">\Drupal\Core\Url</a> @group UrlTest

Namespace

Drupal\Tests\Core

Code

public function testToRenderArray() : void {
    $this->expectDeprecation('Drupal\\Core\\Url::toRenderArray() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3342977');
    $url = Url::fromRoute('entity.node.canonical', [
        'node' => 3,
    ]);
    $this->assertIsArray($url->toRenderArray());
}

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