public function testRegisterRequestWithApplicationIconUrl() { $t1 = new \Growler\NotificationType("TYPE1"); $application = new \Growler\Application("Test application", "http://foo"); $r = new \Growler\Gntp\Request\Register($application); $r->addNotificationType($t1); $this->assertEquals("GNTP/1.0 REGISTER NONE\r\n" . "X-Sender: Growler - PHP Growl notification library\r\n" . "Application-Name: " . $application->getName() . "\r\n" . "Application-Icon: http://foo\r\n" . "Notifications-Count: 1\r\n" . "\r\n" . "Notification-Name: TYPE1\r\n" . "Notification-Enabled: True\r\n" . "\r\n", $r->__toString()); }
/** * @param string $application The application name * @param array $notifications The array of notifications to register */ public function register($application, $notifications) { $message = new \Growler\Gntp\Request\Register($application, $this->_password); foreach ($notifications as $notification) { $message->addNotificationType($notification); } $this->_connection->send($message->__toString()); $this->_connection->consume(); $this->_connection->disconnect(); }