Skip to content

Commit

Permalink
Added failing test for global event manager lists
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyharris committed Aug 23, 2016
1 parent 61f83c0 commit bcac22b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/TestCase/Event/EventManagerTest.php
Expand Up @@ -761,4 +761,27 @@ public function testGetDispatchedEvents()
$result = $manager->getEventList();
$this->assertNull($result);
}

/**
* Test that locally dispatched events are also added to the global manager's event list
*
* @return void
* @triggers Event $this
*/
public function testGetDispatchedEventsFromGlobal()
{
$localList = new EventList();
$globalList = new EventList();

EventManager::instance()->setEventList($globalList);
$manager = new EventManager();
$manager->setEventList($localList);

$event = new Event('Event', $this);

$manager->dispatch($event);

$this->assertTrue($manager->getEventList()->hasEvent('Event'));
$this->assertTrue(EventManager::instance()->getEventList()->hasEvent('Event'));
}
}

0 comments on commit bcac22b

Please sign in to comment.