From 736386ec0732c7146bbfe5be5a08d7ea9c65e691 Mon Sep 17 00:00:00 2001
From: xjm <xjm@65776.no-reply.drupal.org>
Date: Mon, 4 Dec 2023 17:02:24 -0600
Subject: [PATCH] Issue #3405910 by quietone, smustgrave: Fix spelling of test
 constants

---
 core/misc/cspell/dictionary.txt               |  4 --
 .../ContainerAwareEventDispatcherTest.php     | 64 +++++++++----------
 2 files changed, 32 insertions(+), 36 deletions(-)

diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt
index 596773c4ef0f..0b042e48ab21 100644
--- a/core/misc/cspell/dictionary.txt
+++ b/core/misc/cspell/dictionary.txt
@@ -644,21 +644,17 @@ pluggable
 plusthick
 poink
 porterstemmer
-postbar
 postcondition
 postcss
 postfields
-postfoo
 postorder
 postprocess
 postupdate
 poweredby
-prebar
 precache
 preconfigured
 predelete
 prefixsqlite
-prefoo
 preinstall
 preloadable
 preorder
diff --git a/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php b/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php
index 39f2e7b82815..bc61186c0fb6 100644
--- a/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php
+++ b/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php
@@ -29,10 +29,10 @@ class ContainerAwareEventDispatcherTest extends TestCase {
   use ExpectDeprecationTrait;
 
   /* Some pseudo events */
-  const PREFOO = 'pre.foo';
-  const POSTFOO = 'post.foo';
-  const PREBAR = 'pre.bar';
-  const POSTBAR = 'post.bar';
+  const PRE_FOO = 'pre.foo';
+  const POST_FOO = 'post.foo';
+  const PRE_BAR = 'pre.bar';
+  const POST_BAR = 'post.bar';
 
   /**
    * @var \Symfony\Component\EventDispatcher\EventDispatcher
@@ -231,18 +231,18 @@ public function testGetListenerPriorityWithServices() {
 
   public function testInitialState() {
     $this->assertEquals([], $this->dispatcher->getListeners());
-    $this->assertFalse($this->dispatcher->hasListeners(self::PREFOO));
-    $this->assertFalse($this->dispatcher->hasListeners(self::POSTFOO));
+    $this->assertFalse($this->dispatcher->hasListeners(self::PRE_FOO));
+    $this->assertFalse($this->dispatcher->hasListeners(self::POST_FOO));
   }
 
   public function testAddListener() {
     $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']);
     $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']);
     $this->assertTrue($this->dispatcher->hasListeners());
-    $this->assertTrue($this->dispatcher->hasListeners(self::PREFOO));
-    $this->assertTrue($this->dispatcher->hasListeners(self::POSTFOO));
-    $this->assertCount(1, $this->dispatcher->getListeners(self::PREFOO));
-    $this->assertCount(1, $this->dispatcher->getListeners(self::POSTFOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::PRE_FOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::POST_FOO));
+    $this->assertCount(1, $this->dispatcher->getListeners(self::PRE_FOO));
+    $this->assertCount(1, $this->dispatcher->getListeners(self::POST_FOO));
     $this->assertCount(2, $this->dispatcher->getListeners());
   }
 
@@ -307,15 +307,15 @@ public function testGetListenerPriority() {
   public function testDispatch() {
     $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']);
     $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']);
-    $this->dispatcher->dispatch(new Event(), self::PREFOO);
+    $this->dispatcher->dispatch(new Event(), self::PRE_FOO);
     $this->assertTrue($this->listener->preFooInvoked);
     $this->assertFalse($this->listener->postFooInvoked);
     $this->assertInstanceOf(Event::class, $this->dispatcher->dispatch(new Event(), 'no_event'));
-    $this->assertInstanceOf(Event::class, $this->dispatcher->dispatch(new Event(), self::PREFOO));
+    $this->assertInstanceOf(Event::class, $this->dispatcher->dispatch(new Event(), self::PRE_FOO));
     // Any kind of object can be dispatched, not only instances of Event.
-    $this->assertInstanceOf(\stdClass::class, $this->dispatcher->dispatch(new \stdClass(), self::PREFOO));
+    $this->assertInstanceOf(\stdClass::class, $this->dispatcher->dispatch(new \stdClass(), self::PRE_FOO));
     $event = new Event();
-    $return = $this->dispatcher->dispatch($event, self::PREFOO);
+    $return = $this->dispatcher->dispatch($event, self::PRE_FOO);
     $this->assertSame($event, $return);
   }
 
@@ -326,7 +326,7 @@ public function testDispatchForClosure() {
     };
     $this->dispatcher->addListener('pre.foo', $listener);
     $this->dispatcher->addListener('post.foo', $listener);
-    $this->dispatcher->dispatch(new Event(), self::PREFOO);
+    $this->dispatcher->dispatch(new Event(), self::PRE_FOO);
     $this->assertEquals(1, $invoked);
   }
 
@@ -338,7 +338,7 @@ public function testStopEventPropagation() {
     // Manually set priority to enforce $this->listener to be called first
     $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo'], 10);
     $this->dispatcher->addListener('post.foo', [$otherListener, 'postFoo']);
-    $this->dispatcher->dispatch(new Event(), self::POSTFOO);
+    $this->dispatcher->dispatch(new Event(), self::POST_FOO);
     $this->assertTrue($this->listener->postFooInvoked);
     $this->assertFalse($otherListener->postFooInvoked);
   }
@@ -357,23 +357,23 @@ public function testDispatchByPriority() {
     $this->dispatcher->addListener('pre.foo', $listener1, -10);
     $this->dispatcher->addListener('pre.foo', $listener2);
     $this->dispatcher->addListener('pre.foo', $listener3, 10);
-    $this->dispatcher->dispatch(new Event(), self::PREFOO);
+    $this->dispatcher->dispatch(new Event(), self::PRE_FOO);
     $this->assertEquals(['3', '2', '1'], $invoked);
   }
 
   public function testRemoveListener() {
     $this->dispatcher->addListener('pre.bar', $this->listener);
-    $this->assertTrue($this->dispatcher->hasListeners(self::PREBAR));
+    $this->assertTrue($this->dispatcher->hasListeners(self::PRE_BAR));
     $this->dispatcher->removeListener('pre.bar', $this->listener);
-    $this->assertFalse($this->dispatcher->hasListeners(self::PREBAR));
+    $this->assertFalse($this->dispatcher->hasListeners(self::PRE_BAR));
     $this->dispatcher->removeListener('notExists', $this->listener);
   }
 
   public function testAddSubscriber() {
     $eventSubscriber = new TestEventSubscriber();
     $this->dispatcher->addSubscriber($eventSubscriber);
-    $this->assertTrue($this->dispatcher->hasListeners(self::PREFOO));
-    $this->assertTrue($this->dispatcher->hasListeners(self::POSTFOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::PRE_FOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::POST_FOO));
   }
 
   public function testAddSubscriberWithPriorities() {
@@ -384,7 +384,7 @@ public function testAddSubscriberWithPriorities() {
     $this->dispatcher->addSubscriber($eventSubscriber);
 
     $listeners = $this->dispatcher->getListeners('pre.foo');
-    $this->assertTrue($this->dispatcher->hasListeners(self::PREFOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::PRE_FOO));
     $this->assertCount(2, $listeners);
     $this->assertInstanceOf(TestEventSubscriberWithPriorities::class, $listeners[0][0]);
   }
@@ -394,7 +394,7 @@ public function testAddSubscriberWithMultipleListeners() {
     $this->dispatcher->addSubscriber($eventSubscriber);
 
     $listeners = $this->dispatcher->getListeners('pre.foo');
-    $this->assertTrue($this->dispatcher->hasListeners(self::PREFOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::PRE_FOO));
     $this->assertCount(2, $listeners);
     $this->assertEquals('preFoo2', $listeners[0][1]);
   }
@@ -402,28 +402,28 @@ public function testAddSubscriberWithMultipleListeners() {
   public function testRemoveSubscriber() {
     $eventSubscriber = new TestEventSubscriber();
     $this->dispatcher->addSubscriber($eventSubscriber);
-    $this->assertTrue($this->dispatcher->hasListeners(self::PREFOO));
-    $this->assertTrue($this->dispatcher->hasListeners(self::POSTFOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::PRE_FOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::POST_FOO));
     $this->dispatcher->removeSubscriber($eventSubscriber);
-    $this->assertFalse($this->dispatcher->hasListeners(self::PREFOO));
-    $this->assertFalse($this->dispatcher->hasListeners(self::POSTFOO));
+    $this->assertFalse($this->dispatcher->hasListeners(self::PRE_FOO));
+    $this->assertFalse($this->dispatcher->hasListeners(self::POST_FOO));
   }
 
   public function testRemoveSubscriberWithPriorities() {
     $eventSubscriber = new TestEventSubscriberWithPriorities();
     $this->dispatcher->addSubscriber($eventSubscriber);
-    $this->assertTrue($this->dispatcher->hasListeners(self::PREFOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::PRE_FOO));
     $this->dispatcher->removeSubscriber($eventSubscriber);
-    $this->assertFalse($this->dispatcher->hasListeners(self::PREFOO));
+    $this->assertFalse($this->dispatcher->hasListeners(self::PRE_FOO));
   }
 
   public function testRemoveSubscriberWithMultipleListeners() {
     $eventSubscriber = new TestEventSubscriberWithMultipleListeners();
     $this->dispatcher->addSubscriber($eventSubscriber);
-    $this->assertTrue($this->dispatcher->hasListeners(self::PREFOO));
-    $this->assertCount(2, $this->dispatcher->getListeners(self::PREFOO));
+    $this->assertTrue($this->dispatcher->hasListeners(self::PRE_FOO));
+    $this->assertCount(2, $this->dispatcher->getListeners(self::PRE_FOO));
     $this->dispatcher->removeSubscriber($eventSubscriber);
-    $this->assertFalse($this->dispatcher->hasListeners(self::PREFOO));
+    $this->assertFalse($this->dispatcher->hasListeners(self::PRE_FOO));
   }
 
   public function testEventReceivesTheDispatcherInstanceAsArgument() {
-- 
GitLab