function ContainerAwareEventDispatcherTest::testDispatchArgumentOrderDeprecation

Tests argument order deprecation.

@group legacy

File

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

Class

ContainerAwareEventDispatcherTest
Unit tests for the ContainerAwareEventDispatcher.

Namespace

Drupal\Tests\Component\EventDispatcher

Code

public function testDispatchArgumentOrderDeprecation() {
    $this->expectDeprecation('Calling the Symfony\\Component\\EventDispatcher\\EventDispatcherInterface::dispatch() method with a string event name as the first argument is deprecated in drupal:9.1.0, an Event object will be required instead in drupal:10.0.0. See https://www.drupal.org/node/3154407');
    $container = new ContainerBuilder();
    $dispatcher = new ContainerAwareEventDispatcher($container, []);
    $dispatcher->dispatch('foo');
}

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