RequestStackLegacyTest.php

Same filename in other branches
  1. 9 core/tests/Drupal/Tests/Core/Http/RequestStackLegacyTest.php

Namespace

Drupal\Tests\Core\Http

File

core/tests/Drupal/Tests/Core/Http/RequestStackLegacyTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Http;

use Drupal\Core\Http\RequestStack;
use Drupal\Tests\UnitTestCase;

/**
 * @coversDefaultClass \Drupal\Core\Http\RequestStack
 * @group legacy
 *
 * @todo Remove this in Drupal 11 https://www.drupal.org/node/3265121
 */
class RequestStackLegacyTest extends UnitTestCase {
    
    /**
     * Tests deprecation message in our subclassed RequestStack.
     *
     * @covers ::getMainRequest
     */
    public function testGetMainRequestDeprecation() : void {
        $stack = new RequestStack();
        $this->expectDeprecation('The Drupal\\Core\\Http\\RequestStack is deprecated in drupal:10.0.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3265357');
        $this->assertNull($stack->getMainRequest());
    }

}

Classes

Title Deprecated Summary
RequestStackLegacyTest @coversDefaultClass \Drupal\Core\Http\RequestStack @group legacy

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