public static function init($messageReceiver = null)
 {
     Zotero_Notifier::registerObserver(__CLASS__, ["library", "apikey-library"], "NotifierObserver");
     // Send notifications to SNS by default
     self::$messageReceivers[] = function ($topic, $message) {
         $sns = Z_Core::$AWS->createSns();
         $sns->publish(['TopicArn' => $topic, 'Message' => $message]);
     };
 }
Exemple #2
0
 public function testReset()
 {
     $event = "add";
     $type = "item";
     $mock = $this->getMock('stdClass', array('notify'));
     $mock->expects($this->never())->method('notify');
     $hash = Zotero_Notifier::registerObserver($mock, $type);
     Zotero_Notifier::begin();
     Zotero_Notifier::trigger($event, $type, "1/AAAAAAAA");
     Zotero_Notifier::trigger($event, $type, "1/BBBBBBBB");
     Zotero_Notifier::reset();
     Zotero_Notifier::commit();
     Zotero_Notifier::unregisterObserver($hash);
 }