Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

completed Tests

  • Loading branch information...
commit 842b88f1c474183fcbdece984ba5686e1308b9bf 1 parent c27fccd
@tidal authored
View
10 src/Dispatcher/ObjectMapDispatcher.php
@@ -228,12 +228,14 @@ protected static function doNotify(array $listeners, $subject){
*/
protected static function doNotifyUntil(array $listeners, $subject){
$res = NULL;
- foreach ($listeners as $listener){
+ foreach ($listeners as $listener){
if($listener instanceof \PEIP\INF\Handler\Handler){
$res = $listener->handle($subject);
- if ($res){
- return $listener;
- }
+ }elseif(is_callable($listener)){
+ $res = call_user_func($listener, $subject);
+ }
+ if ($res){
+ return $res;
}
}
return $res;
View
4 tests/dispatcher/ObjectMapDispatcherTest.php
@@ -103,7 +103,7 @@ public function testNotify(){
public function testNotifyUntil(){
$object = new stdClass;
$callable = new CallableObject($this);
- $callable->setObject($object);
+ $callable->setObject($object);
$listeners = array();
$listener1 = new PEIP_Callable_Handler(array($callable, 'callNotify'));
$this->dispatcher->connect('foo', $object, $listener1);
@@ -114,7 +114,7 @@ public function testNotifyUntil(){
$listener3 = new PEIP_Callable_Handler(array($callable, 'callNoMore'));
$this->dispatcher->connect('foo', $object, $listener3);
$breaker = $this->dispatcher->notifyUntil('foo', $object);
- $this->assertSame($listener2, $breaker);
+ $this->assertSame($object, $breaker);
// test to get full code-coverage
Please sign in to comment.
Something went wrong with that request. Please try again.