function CompiledRouteLegacyTest::testOptionsDeprecated

Tests for deprecated message and no PHP error.

@covers ::getOptions

File

core/tests/Drupal/Tests/Core/Routing/CompiledRouteLegacyTest.php, line 57

Class

CompiledRouteLegacyTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Routing%21CompiledRoute.php/class/CompiledRoute/9" title="A compiled route contains derived information from a route object." class="local">\Drupal\Core\Routing\CompiledRoute</a> @group Routing @group legacy

Namespace

Drupal\Tests\Core\Routing

Code

public function testOptionsDeprecated() {
    $this->expectDeprecation('Drupal\\Core\\Routing\\CompiledRoute::getOptions() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3159706');
    if (PHP_VERSION_ID >= 80000) {
        $this->expectWarning();
        $this->expectWarningMessage('Undefined property: Drupal\\Core\\Routing\\CompiledRoute::$route');
    }
    else {
        $this->expectNotice();
        $this->expectNoticeMessage('Undefined property: Drupal\\Core\\Routing\\CompiledRoute::$route');
    }
    $this->compiled_route
        ->getOptions();
}

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