Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing the solution

  • Loading branch information...
commit f512348f5e4153d91da6ced1e78657a2dfe5bcc1 1 parent bcc912b
@Lansoweb Lansoweb authored
View
4 library/Zend/EventManager/SharedEventManager.php
@@ -120,10 +120,6 @@ public function getEvents($id)
public function getListeners($id, $event)
{
if (!array_key_exists($id, $this->identifiers)) {
- //Check if there are any id wildcards listeners
- if ('*' != $id && array_key_exists('*', $this->identifiers)) {
- return $this->identifiers['*']->getListeners($event);
- }
return false;
}
return $this->identifiers[$id]->getListeners($event);
View
10 tests/ZendTest/EventManager/StaticEventManagerTest.php
@@ -195,11 +195,19 @@ public function testCanGetListenersByResourceAndEvent()
$this->assertEquals(1, count($listeners));
}
- public function testCanGetListenersByWildcardAndEvent()
+ public function testCanNotGetListenersByResourceAndEventWithWildcard()
{
$events = StaticEventManager::getInstance();
$events->attach('*', 'bar', array($this, __FUNCTION__));
$listeners = $events->getListeners('foo', 'bar');
+ $this->assertFalse($listeners);
+ }
+
+ public function testCanGetListenersByWildcardAndEvent()
+ {
+ $events = StaticEventManager::getInstance();
+ $events->attach('*', 'bar', array($this, __FUNCTION__));
+ $listeners = $events->getListeners('*', 'bar');
$this->assertInstanceOf('Zend\Stdlib\PriorityQueue', $listeners);
$this->assertEquals(1, count($listeners));
}
Please sign in to comment.
Something went wrong with that request. Please try again.