Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
@@ -153,6 +153,31 @@ class TraceableEventDispatcherTest extends TestCase
|
||||
$this->assertCount(2, $dispatcher->getCalledListeners());
|
||||
}
|
||||
|
||||
public function testItReturnsNoOrphanedEventsWhenCreated()
|
||||
{
|
||||
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
|
||||
$events = $tdispatcher->getOrphanedEvents();
|
||||
$this->assertEmpty($events);
|
||||
}
|
||||
|
||||
public function testItReturnsOrphanedEventsAfterDispatch()
|
||||
{
|
||||
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
|
||||
$tdispatcher->dispatch('foo');
|
||||
$events = $tdispatcher->getOrphanedEvents();
|
||||
$this->assertCount(1, $events);
|
||||
$this->assertEquals(array('foo'), $events);
|
||||
}
|
||||
|
||||
public function testItDoesNotReturnHandledEvents()
|
||||
{
|
||||
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
|
||||
$tdispatcher->addListener('foo', function () {});
|
||||
$tdispatcher->dispatch('foo');
|
||||
$events = $tdispatcher->getOrphanedEvents();
|
||||
$this->assertEmpty($events);
|
||||
}
|
||||
|
||||
public function testLogger()
|
||||
{
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
@@ -246,6 +271,17 @@ class TraceableEventDispatcherTest extends TestCase
|
||||
|
||||
$this->assertCount(1, $eventDispatcher->getListeners('foo'), 'expected listener1 to be removed');
|
||||
}
|
||||
|
||||
public function testClearOrphanedEvents()
|
||||
{
|
||||
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
|
||||
$tdispatcher->dispatch('foo');
|
||||
$events = $tdispatcher->getOrphanedEvents();
|
||||
$this->assertCount(1, $events);
|
||||
$tdispatcher->reset();
|
||||
$events = $tdispatcher->getOrphanedEvents();
|
||||
$this->assertCount(0, $events);
|
||||
}
|
||||
}
|
||||
|
||||
class EventSubscriber implements EventSubscriberInterface
|
||||
|
Reference in New Issue
Block a user