Loading core/misc/cspell/dictionary.txt +0 −4 Original line number Diff line number Diff line Loading @@ -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 Loading core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php +32 −32 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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()); } Loading Loading @@ -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); } Loading @@ -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); } Loading @@ -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); } Loading @@ -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() { Loading @@ -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]); } Loading @@ -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]); } Loading @@ -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() { Loading Loading
core/misc/cspell/dictionary.txt +0 −4 Original line number Diff line number Diff line Loading @@ -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 Loading
core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php +32 −32 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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()); } Loading Loading @@ -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); } Loading @@ -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); } Loading @@ -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); } Loading @@ -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() { Loading @@ -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]); } Loading @@ -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]); } Loading @@ -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() { Loading