Issue #3405910 by quietone, smustgrave: Fix spelling of test constants

merge-requests/5709/head
xjm 2023-12-04 17:02:24 -06:00
parent 93ce846966
commit 736386ec07
No known key found for this signature in database
GPG Key ID: 206B0B8743BDF4C2
2 changed files with 32 additions and 36 deletions

View File

@ -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

View File

@ -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 @@ class ContainerAwareEventDispatcherTest extends TestCase {
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 @@ class ContainerAwareEventDispatcherTest extends TestCase {
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 @@ class ContainerAwareEventDispatcherTest extends TestCase {
};
$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 @@ class ContainerAwareEventDispatcherTest extends TestCase {
// 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 @@ class ContainerAwareEventDispatcherTest extends TestCase {
$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 @@ class ContainerAwareEventDispatcherTest extends TestCase {
$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 @@ class ContainerAwareEventDispatcherTest extends TestCase {
$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 @@ class ContainerAwareEventDispatcherTest extends TestCase {
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() {