public function testNotifyRequestWithNotificationCustomIcon() { $application = new \Growler\Application("Test application"); $n = new \Growler\Notification(new \Growler\NotificationType("TYPE1"), "Title", "Message", "http://foo"); $r = new \Growler\Gntp\Request\Notify($application, $n); $this->assertEquals("GNTP/1.0 NOTIFY NONE\r\n" . "X-Sender: Growler - PHP Growl notification library\r\n" . "Application-Name: " . $application->getName() . "\r\n" . "Notification-Name: " . $n->getType()->getName() . "\r\n" . "Notification-Title: " . $n->getTitle() . "\r\n" . "Notification-Text: " . $n->getMessage() . "\r\n" . "Notification-Icon: " . $n->getIcon() . "\r\n" . "\r\n", $r->__toString()); }
/** * @param string $application The application name * @param Growler\Notification $notification The notification to send */ public function send($application, $notification) { // pack(protocol version, type, priority/sticky flags, notification name length, title length, message length. app name length) $data = pack('c2n5', 1, 1, 0, strlen($notification->getType()->getName()), strlen($notification->getTitle()), strlen($notification->getMessage()), strlen($application->getName())) . $notification->getType()->getName() . $notification->getTitle() . $notification->getMessage() . $application->getName(); $this->_sendMessage($data); }