function test_webpush_main_sendnotification()
 {
     $oldNum = getSentNotificationNum();
     WebPush_Main::sendNotification('A Title', 'A Body', 'http://marco/marco.png', 'http://marco/', null);
     $payload = get_option('webpush_payload');
     $this->assertEquals('A Title', $payload['title']);
     $this->assertEquals('A Body', $payload['body']);
     $this->assertEquals('http://marco/marco.png', $payload['icon']);
     $this->assertEquals('http://marco/', $payload['url']);
     $this->assertEquals('', $payload['postID']);
     $this->assertEquals($oldNum + 1, getSentNotificationNum());
 }
 function send_multiple_notifications_success_with_VAPID($forceWP)
 {
     $oldNum = getSentNotificationNum();
     $webPush = new WebPush($forceWP);
     $webPush->setGCMKey('aKey');
     $webPush->setVAPIDInfo(file_get_contents('tests/example_ec_key_with_public_key.pem'), 'https://example.org', 'mailto:webpush_ops@catfacts.example.com');
     $self = $this;
     $webPush->addRecipient('https://android.googleapis.com/gcm/send/endpoint', function ($success) use($self) {
         $self->assertTrue($success);
     });
     $webPush->addRecipient('http://localhost:55555/201' . (USE_VAPID ? '//vapid' : ''), function ($success) use($self) {
         $self->assertTrue($success);
     });
     $webPush->addRecipient('http://localhost:55555/200' . (USE_VAPID ? '//vapid' : ''), function ($success) use($self) {
         $self->assertTrue($success);
     });
     $webPush->requests[0]['url'] = 'http://localhost:55555/200/gcm';
     $webPush->sendNotifications();
     $this->assertEquals($oldNum + 3, getSentNotificationNum());
 }