You are here

public function ContainerAwareEventDispatcherTest::testDispatchArgumentOrderDeprecation in Drupal 9

Tests argument order deprecation.

@group legacy

File

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

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');
}