function assertMatchingNotification($matcher, $subject) { // register observer $observer = $this->getMock("Observer"); NotificationCenter::addObserver($observer, 'update', 'SomeNotification', $matcher); // expect notication $observer->expects($this->once())->method('update')->with('SomeNotification', $subject); // fire! NotificationCenter::postNotification('SomeNotification', $subject); // remove observer NotificationCenter::removeObserver($observer); }