function ContainerAwareEventDispatcherTest::testSymfonyInheritedEventDeprecation

Tests deprecation notice for Symfony Event class inheritance.

@group legacy

File

core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php, line 192

Class

ContainerAwareEventDispatcherTest
Unit tests for the ContainerAwareEventDispatcher.

Namespace

Drupal\Tests\Component\EventDispatcher

Code

public function testSymfonyInheritedEventDeprecation() {
    $this->expectDeprecation('Symfony\\Component\\EventDispatcher\\Event is deprecated in drupal:9.1.0 and will be replaced by Symfony\\Contracts\\EventDispatcher\\Event in drupal:10.0.0. A new Drupal\\Component\\EventDispatcher\\Event class is available to bridge the two versions of the class. See https://www.drupal.org/node/3159012');
    $container = new ContainerBuilder();
    $dispatcher = new ContainerAwareEventDispatcher($container, []);
    $dispatcher->dispatch(new SymfonyInheritedEvent());
}

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