function LoggerChannelFactoryTest::testConstructorDeprecation

@covers ::__construct
@group legacy

File

core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php, line 40

Class

LoggerChannelFactoryTest
@coversDefaultClass \Drupal\Core\Logger\LoggerChannelFactory[[api-linebreak]] @group Logger

Namespace

Drupal\Tests\Core\Logger

Code

public function testConstructorDeprecation() : void {
  $container = $this->prophesize(ContainerInterface::class);
  $container->get('request_stack')
    ->willReturn($this->prophesize(RequestStack::class)
    ->reveal());
  $container->get('current_user')
    ->willReturn($this->prophesize(AccountProxy::class)
    ->reveal());
  \Drupal::setContainer($container->reveal());
  $this->expectDeprecation('Calling Drupal\\Core\\Logger\\LoggerChannelFactory::__construct without the $requestStack argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3416354');
  $this->expectDeprecation('Calling Drupal\\Core\\Logger\\LoggerChannelFactory::__construct without the $currentUser argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3416354');
  new LoggerChannelFactory();
}

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