composer update

This commit is contained in:
2019-06-23 10:14:30 +00:00
parent a56db5ea2b
commit ec4506ebf4
790 changed files with 35767 additions and 7663 deletions

View File

@@ -18,6 +18,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;
class TraceableEventDispatcherTest extends TestCase
{
@@ -69,7 +70,7 @@ class TraceableEventDispatcherTest extends TestCase
// Verify that priority is preserved when listener is removed and re-added
// in preProcess() and postProcess().
$tdispatcher->dispatch('foo', new Event());
$tdispatcher->dispatch(new Event(), 'foo');
$listeners = $dispatcher->getListeners('foo');
$this->assertSame(123, $tdispatcher->getListenerPriority('foo', $listeners[0]));
}
@@ -84,7 +85,7 @@ class TraceableEventDispatcherTest extends TestCase
};
$tdispatcher->addListener('bar', $listener, 5);
$tdispatcher->dispatch('bar');
$tdispatcher->dispatch(new Event(), 'bar');
$this->assertSame(5, $priorityWhileDispatching);
}
@@ -115,7 +116,7 @@ class TraceableEventDispatcherTest extends TestCase
$this->assertEquals([], $tdispatcher->getCalledListeners());
$this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners);
$tdispatcher->dispatch('foo');
$tdispatcher->dispatch(new Event(), 'foo');
$listeners = $tdispatcher->getCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
@@ -129,7 +130,7 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$tdispatcher->addListener('foo', function () {}, 5);
$tdispatcher->dispatch('foo');
$tdispatcher->dispatch(new Event(), 'foo');
$tdispatcher->reset();
$listeners = $tdispatcher->getNotCalledListeners();
@@ -139,13 +140,26 @@ class TraceableEventDispatcherTest extends TestCase
$this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners);
}
public function testDispatchContractsEvent()
{
$expectedEvent = new ContractsEvent();
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$tdispatcher->addListener('foo', function ($event) use ($expectedEvent) {
$this->assertSame($event, $expectedEvent);
}, 5);
$tdispatcher->dispatch($expectedEvent, 'foo');
$listeners = $tdispatcher->getCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
}
public function testDispatchAfterReset()
{
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$tdispatcher->addListener('foo', function () {}, 5);
$tdispatcher->reset();
$tdispatcher->dispatch('foo');
$tdispatcher->dispatch(new Event(), 'foo');
$listeners = $tdispatcher->getCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
@@ -157,10 +171,10 @@ class TraceableEventDispatcherTest extends TestCase
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$dispatcher->addListener('foo', function (Event $event, $eventName, $dispatcher) use (&$tdispatcher) {
$tdispatcher = $dispatcher;
$dispatcher->dispatch('bar');
$dispatcher->dispatch(new Event(), 'bar');
});
$dispatcher->addListener('bar', function (Event $event) {});
$dispatcher->dispatch('foo');
$dispatcher->dispatch(new Event(), 'foo');
$this->assertSame($dispatcher, $tdispatcher);
$this->assertCount(2, $dispatcher->getCalledListeners());
}
@@ -175,7 +189,7 @@ class TraceableEventDispatcherTest extends TestCase
public function testItReturnsOrphanedEventsAfterDispatch()
{
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$tdispatcher->dispatch('foo');
$tdispatcher->dispatch(new Event(), 'foo');
$events = $tdispatcher->getOrphanedEvents();
$this->assertCount(1, $events);
$this->assertEquals(['foo'], $events);
@@ -185,7 +199,7 @@ class TraceableEventDispatcherTest extends TestCase
{
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$tdispatcher->addListener('foo', function () {});
$tdispatcher->dispatch('foo');
$tdispatcher->dispatch(new Event(), 'foo');
$events = $tdispatcher->getOrphanedEvents();
$this->assertEmpty($events);
}
@@ -202,7 +216,7 @@ class TraceableEventDispatcherTest extends TestCase
$logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']);
$logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']);
$tdispatcher->dispatch('foo');
$tdispatcher->dispatch(new Event(), 'foo');
}
public function testLoggerWithStoppedEvent()
@@ -218,7 +232,7 @@ class TraceableEventDispatcherTest extends TestCase
$logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', ['event' => 'foo', 'listener' => 'closure']);
$logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', ['event' => 'foo', 'listener' => 'closure']);
$tdispatcher->dispatch('foo');
$tdispatcher->dispatch(new Event(), 'foo');
}
public function testDispatchCallListeners()
@@ -230,7 +244,7 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo1'; }, 10);
$tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo2'; }, 20);
$tdispatcher->dispatch('foo');
$tdispatcher->dispatch(new Event(), 'foo');
$this->assertSame(['foo2', 'foo1'], $called);
}
@@ -243,14 +257,14 @@ class TraceableEventDispatcherTest extends TestCase
$dispatcher->addListener('foo', $listener1 = function () use ($dispatcher, &$loop) {
++$loop;
if (2 == $loop) {
$dispatcher->dispatch('foo');
$dispatcher->dispatch(new Event(), 'foo');
}
});
$dispatcher->addListener('foo', function () use (&$dispatchedEvents) {
++$dispatchedEvents;
});
$dispatcher->dispatch('foo');
$dispatcher->dispatch(new Event(), 'foo');
$this->assertSame(2, $dispatchedEvents);
}
@@ -260,14 +274,14 @@ class TraceableEventDispatcherTest extends TestCase
$nestedCall = false;
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$dispatcher->addListener('foo', function (Event $e) use ($dispatcher) {
$dispatcher->dispatch('bar', $e);
$dispatcher->dispatch(new Event(), 'bar', $e);
});
$dispatcher->addListener('bar', function (Event $e) use (&$nestedCall) {
$nestedCall = true;
});
$this->assertFalse($nestedCall);
$dispatcher->dispatch('foo');
$dispatcher->dispatch(new Event(), 'foo');
$this->assertTrue($nestedCall);
}
@@ -279,7 +293,7 @@ class TraceableEventDispatcherTest extends TestCase
};
$eventDispatcher->addListener('foo', $listener1);
$eventDispatcher->addListener('foo', function () {});
$eventDispatcher->dispatch('foo');
$eventDispatcher->dispatch(new Event(), 'foo');
$this->assertCount(1, $eventDispatcher->getListeners('foo'), 'expected listener1 to be removed');
}
@@ -287,7 +301,7 @@ class TraceableEventDispatcherTest extends TestCase
public function testClearOrphanedEvents()
{
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$tdispatcher->dispatch('foo');
$tdispatcher->dispatch(new Event(), 'foo');
$events = $tdispatcher->getOrphanedEvents();
$this->assertCount(1, $events);
$tdispatcher->reset();