/** * @param \Stagehand\TestRunner\Notification\Notification $notification * * @return string */ protected function buildNotifyCommand(Notification $notification) { if ($notification->isPassed()) { $title = self::TITLE_PASSED; $icon = self::$ICON_PASSED; $sound = self::SOUND_PASSED; } elseif ($notification->isFailed()) { $title = self::TITLE_FAILED; $icon = self::$ICON_FAILED; $sound = self::SOUND_FAILED; } elseif ($notification->isStopped()) { $title = self::TITLE_STOPPED; $icon = self::$ICON_STOPPED; $sound = self::SOUND_STOPPED; } if ($this->os->isWin()) { return sprintf('growlnotify /t:%s /p:-2 /i:%s /a:Stagehand_TestRunner /r:%s,%s,%s /n:%s /silent:true %s', escapeshellarg($title), escapeshellarg($icon), escapeshellarg(self::TITLE_PASSED), escapeshellarg(self::TITLE_FAILED), escapeshellarg(self::TITLE_STOPPED), escapeshellarg($title), escapeshellarg($notification->getMessage())); } elseif ($this->os->isAfterMarvericks() && !$this->hasGrowl('osascript')) { return sprintf('osascript -e "display notification \\"%s\\" subtitle \\"%s\\" sound name \\"%s\\""', escapeshellarg($notification->getMessage()), escapeshellcmd($title), escapeshellcmd($sound)); } elseif ($this->os->isDarwin()) { return sprintf('growlnotify --name %s --priority -2 --image %s --title %s --message %s', escapeshellarg($title), escapeshellarg($icon), escapeshellarg($title), escapeshellarg($notification->getMessage())); } elseif ($this->os->isLinux()) { return sprintf('notify-send --urgency=low --icon=%s %s %s', escapeshellarg($icon), escapeshellarg($title), escapeshellarg(str_replace('\\', '\\\\', $notification->getMessage()))); } }
/** * @param \Stagehand\TestRunner\Notification\Notification $notification * @return string */ protected function buildNotifyCommand(Notification $notification) { if ($notification->isPassed()) { $title = self::TITLE_PASSED; $icon = self::$ICON_PASSED; } elseif ($notification->isFailed()) { $title = self::TITLE_FAILED; $icon = self::$ICON_FAILED; } elseif ($notification->isStopped()) { $title = self::TITLE_STOPPED; $icon = self::$ICON_STOPPED; } if ($this->os->isWin()) { return sprintf('growlnotify /t:%s /p:-2 /i:%s /a:Stagehand_TestRunner /r:%s,%s,%s /n:%s /silent:true %s', escapeshellarg($title), escapeshellarg($icon), escapeshellarg(self::TITLE_PASSED), escapeshellarg(self::TITLE_FAILED), escapeshellarg(self::TITLE_STOPPED), escapeshellarg($title), escapeshellarg($notification->getMessage())); } elseif ($this->os->isDarwin()) { return sprintf('growlnotify --name %s --priority -2 --image %s --title %s --message %s', escapeshellarg($title), escapeshellarg($icon), escapeshellarg($title), escapeshellarg($notification->getMessage())); } elseif ($this->os->isLinux()) { return sprintf('notify-send --urgency=low --icon=%s %s %s', escapeshellarg($icon), escapeshellarg($title), escapeshellarg(str_replace('\\', '\\\\', $notification->getMessage()))); } }