Last active
September 30, 2019 20:27
-
-
Save nickclasener/19a029015ba27d23aef93c4d9e7bd134 to your computer and use it in GitHub Desktop.
Adds Godlike quake sound after tests passed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Location vendor/spatie/phpunit-watcher/src/Notification.php --> | |
<?php | |
namespace Spatie\PhpUnitWatcher; | |
use Joli\JoliNotif\NotifierFactory; | |
use Joli\JoliNotif\Notification as JoliNotification; | |
class Notification | |
{ | |
/** @var \Joli\JoliNotif\Notification */ | |
protected $joliNotification; | |
public static function create() | |
{ | |
$joliNotification = (new JoliNotification) | |
->setTitle('PHPUnit Watcher') | |
->setIcon(__DIR__.'/../images/notificationIcon.png'); | |
return new static($joliNotification); | |
} | |
protected function __construct(JoliNotification $joliNotification) | |
{ | |
$this->joliNotification = $joliNotification; | |
} | |
public function passingTests() | |
{ | |
$this->joliNotification->setBody('✅ Tests passed!'); | |
$this->send(); | |
shell_exec('play ~/Music/godlike.mp3 -q </dev/null &>/dev/null &'); | |
} | |
public function failingTests() | |
{ | |
$this->joliNotification->setBody('❌ Tests failed!'); | |
$this->send(); | |
} | |
protected function send() | |
{ | |
return NotifierFactory::create()->send($this->joliNotification); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment